Valid Level List¶
GET /api/v1/issue-level/valid/list
Overview¶
Lists the levels used for incident management and their identifiers.
Prerequisites and Usage Steps¶
Obtain the target UUID from the workspace list and pass it as workspaceUUID. Select a level by name and source, and use its uuid in subsequent operations that require a level identifier. When site-wide unified levels are enabled, only site levels are returned. When disabled, workspace custom levels are returned, along with system default levels that have not been disabled by the workspace.
The example uses External API signature version v20240417. Set the target site's External API URL, Access Key, and Secret Key as DF_EXTERNAL_API_URL, DF_EXTERNAL_ACCESS_KEY, and DF_EXTERNAL_SECRET_KEY respectively. Replace the example IDs with actual values.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Signature version; the following example uses v20240417. Example: v20240417How to obtain or fill in: Fill in as shown in the example, matching the signature algorithm. |
|
| X-Df-Access-Key | string | Y | Request AK information Example: <access-key>How to obtain or fill in: Assigned by the External API administrator. |
| X-Df-Signature | string | Y | Signature information Example: <hex-signature>How to obtain or fill in: Use the Secret Key to compute HMAC-SHA256 over the text composed of GET, the nonce, the request path and raw query string, the timestamp, and an empty string, then take the hexadecimal result. |
| X-Df-Timestamp | string | Y | Timestamp of the request Example: 1785456000How to obtain or fill in: Fill in the current Unix seconds at the time of the call, for example by running date +%s. |
| X-Df-Nonce | string | Y | Nonce generated for the request Example: b53b47e12e514616ad8cb1f17cb66dceHow to obtain or fill in: Generate a new random value for each request, for example uuid.uuid4().hex. |
Query Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| workspaceUUID | string | Target workspace UUID. Example: wksp_exampleHow to obtain or fill in: Obtain from content.data[].uuid in the workspace list response and use the original value. |
Additional Parameter Notes¶
Use the External API signature credentials assigned to the current target site.
Request Example¶
import hmac
import os
import time
import uuid
from urllib.parse import urlencode
import requests
server = os.environ["DF_EXTERNAL_API_URL"].rstrip("/")
path = "/api/v1/issue-level/valid/list"
query = {'workspaceUUID': 'wksp_example'}
if query:
path += "?" + urlencode(query)
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
payload = " ".join(("GET", nonce, path, timestamp, ""))
signature = hmac.digest(os.environ["DF_EXTERNAL_SECRET_KEY"].encode(), payload.encode(), "sha256").hex()
headers = {
"X-Df-Access-Key": os.environ["DF_EXTERNAL_ACCESS_KEY"],
"X-Df-Timestamp": timestamp,
"X-Df-Nonce": nonce,
"X-Df-SVersion": "v20240417",
"X-Df-Signature": signature,
}
try:
result = requests.get(server + path, headers=headers, timeout=15)
except requests.RequestException:
print('Read failed; back off, re-sign, and retry, keeping the traceId and query conditions.')
raise SystemExit(1)
if not 200 <= result.status_code < 300:
print("HTTP", result.status_code, result.text) # Keep errorCode, content, and traceId; do not output AK/SK.
raise SystemExit(1)
data = result.json()["content"]
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content | array<object> |
Results on this page; an empty array when there are no records. |
| content[].uuid | string | Level identifier; use the returned original value. |
| content[].name | string | Level name. |
| content[].color | string | Display color. |
| content[].description | string | Level description. |
| content[].isDefault | boolean | System default levels carry this flag. |
| content[].isManage | boolean | Site levels configured in the management backend may carry this flag. |
| content[].status | integer | Level record status; system default items may omit this field. |
{
"code": 200,
"content": [
{
"uuid": "issue_level_example",
"name": "高",
"color": "#d93434",
"description": "需要关注",
"status": 0
}
],
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | An undeclared Query parameter is passed | The message indicates the invalid parameter. | Remove fields not listed in the parameter table. |