Custom Level Add¶
POST /api/v1/issue-level/add
Overview¶
Create a custom Issue level in the current workspace.
Before Calling and Usage Steps¶
Submit only the name and color; description and extend are optional. A workspace can have at most 10 undeleted custom levels, and the name must not duplicate an existing undeleted custom level in the same workspace. On success, a UUID starting with issl_ is returned. If platform global levels take precedence, a newly created level may be saved but not immediately appear in the effective level list; use the effective list to determine whether it can be used for Issues. The operation uses the workspace to which the current API Key belongs; obtain resource identifiers from the same workspace. After a timeout, first check the level configuration in the console to confirm whether the level was created, and then decide whether to retry.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or specify: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| extend.custom field | json | Arbitrary additional JSON field. Example: urgentHow to obtain or specify: Name it as required by the integrating system, and keep the field type stable. |
|
| name | string | Y | Level name. Required on creation; the declared maximum length is 256 characters, but the current persistence field is shorter, so keep it within 128 characters. Allow null: False Maximum length: 256 Example: 紧急处理How to obtain or specify: Choose a name not already used in this workspace based on your business needs; we recommend no more than 128 characters. |
| description | string | Optional level description. Allow null: False Example: 需要当天响应How to obtain or specify: Briefly describe the criteria and expected response time; we recommend no more than 1024 characters. If omitted, use an empty string. |
|
| extend | json | Optional additional JSON, saved on creation; there are no fixed business subfields. Allow null: True Example: {}How to obtain or specify: Pass a JSON object when you need to save custom additional information; if there is no content, omit it or pass {}. |
|
| color | string | Y | Level color. Required on creation. The server declares it as a string and does not restrict it to an enumerated color format. Allow null: False Example: #FF7931How to obtain or specify: Choose a color that the client can display; we recommend using a #RRGGBB string. |
Additional Parameter Notes¶
Creating a custom level does not change the level of historical Issues and does not directly send Issue notifications. The current route's 256-character declaration for the name differs from the persistence capacity; using the recommended length reduces save failures.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/issue-level/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"紧急处理","color":"#FF7931","description":"需要当天响应"}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Record ID. In responses for creating an Issue or reply, this may be null when constructed before persistence; use uuid to operate on the resource. |
| content.uuid | string | Resource UUID. |
| content.workspaceUUID | string | Workspace UUID. |
| content.status | integer | Record status; 0 = normal, 3 = deleted. This is distinct from the Issue business status statusType. |
| content.creator | string | Caller identity for creation; may be an API Key identifier, account, or system identity. |
| content.updator | string | Identity of the last update; empty string if not set. |
| content.createAt | integer | Creation time, Unix seconds. |
| content.updateAt | integer | Last update time, Unix seconds; may be -1 if not updated. |
| content.deleteAt | integer | Deletion time, Unix seconds; -1 if not deleted. |
| content.name | string | Custom level name. |
| content.color | string | Color string. |
| content.description | string | Level description. |
| content.extend | object or null | Additional JSON object saved on creation; the level modification API does not currently modify this field. |
| content.isManage | boolean or number | Whether this is a platform-managed level; workspace-created levels are usually false. |
| content.declaration | object or null | Workspace public declaration; attached only at the content level. |
{
"code": 200,
"content": {
"id": 201,
"uuid": "issl_example",
"workspaceUUID": "wksp_example",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785430800,
"updateAt": -1,
"deleteAt": -1,
"name": "紧急处理",
"description": "需要当天响应",
"color": "#FF7931",
"extend": {},
"isManage": false,
"declaration": {}
},
"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 | A request field is missing, or the field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | The request JSON syntax is invalid | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The JSON top level is not an object | Some JSON file format error | Submit a JSON object. |
| 406 | ft.IssueLevelCountLimit | This workspace already has 10 undeleted custom levels | The workspace's custom levels exceed the maximum allowed number of 10 | Delete custom levels that are no longer used, and then retry. |
| 406 | ft.IssueLevelNameExists | This workspace already has an undeleted custom level with the same name | The level name already exists | Choose a different name; after a timeout, first confirm whether it has already been created. |
| 500 | ft.InternalServerError | Failed to save the level or configuration, perform auditing, or complete other internal processing | Internal error | First read the current level or configuration to confirm the result, and then decide whether to retry; if the failure persists, provide the traceId. |