Modify Custom Level¶
POST /api/v1/incidents/level/{incidents_level_uuid}/modify
Overview¶
Modify the name, color, and description of a custom incident level in the current workspace.
Prerequisites and Usage Steps¶
The Key must have incidents.incidentsLevelManage, and access is limited to the workspace to which the current Key belongs. This module shares the underlying level and default level configuration with the Issue level API. Changes may affect both incident and Issue level selection; this module does not create an independent copy. When global levels are enabled in the backend, the actual effective level selection may be determined first by the global configuration. The management list for the current workspace still lists only default and workspace custom items and does not include backend global levels. Administrators should confirm the effective scope before modifying, and should not treat all items in the management list as available levels.
Only name/color/description are actually updated; omitted fields remain unchanged; an empty string for description clears it; extend is currently ignored. Passing {} still updates the time. This changes only the level configuration; it does not batch rewrite the level UUID of historical incidents or resend notifications. Historical UI displays may resolve the name/color again based on this level. Name modification checks for duplicate names among active custom levels in the same workspace. The response includes an additional old_name for verification, but does not return a snapshot of all old fields.
Path Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| incidents_level_uuid | string | Y | UUID of a custom level in the current workspace; you cannot enter a default level such as system_level_0 or a backend global level.Example: issl_exampleHow to obtain or enter: Take the uuid from an item with isDefault=false in the Incident Level List. |
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 enter: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Required for creation and optional for modification; active custom levels in the same workspace cannot have duplicate names. The declaration allows up to 256 characters, the database allows 128, and 1 to 128 characters is recommended; non-empty is not currently enforced. Allowed null: False Maximum length: 256 Example: P3-轻微How to obtain or enter: Define an easily recognizable name based on business severity. |
|
| description | string | Optional string. If omitted during creation, it defaults to an empty string; if omitted during modification, it remains unchanged; an empty string clears it; null is not accepted. The database allows 1024 characters, and callers should enforce a limit. Allowed null: False Example: 局部功能受影响How to obtain or enter: The business owner fills in the level criteria. |
|
| extend | json | For creation, only an object or null is accepted; if omitted, it defaults to {}. Arrays, strings, and other types are rejected by declaration validation with 406. Although the modification route declares this field, objects or null that pass validation are still ignored by the controller; the old extend is not changed and cannot be cleared with {}.Allowed null: True Example: {}How to obtain or enter: On creation, enter the JSON business extension to be saved. |
|
| color | string | Required for creation and optional for modification; only a string is declared, the color format is not validated, the database allows 128 characters, and a valid hexadecimal color is recommended. Allowed null: False Example: #3F94DCHow to obtain or enter: Enter according to the customer UI color scheme; #RRGGBB is recommended. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/incidents/level/issl_example/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"color":"#6C7AEB","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 | Database row ID; use uuid for business identification; it can be null in pre-submission snapshots. |
| content.uuid | string | UUID of the resource. |
| content.status | integer | Database status: 0 active / 3 deleted; this is different from the incident business status incidentsStatus. |
| content.creator | string | Creator; for an API Key, this is generally wsak_ plus the resource UUID. |
| content.updator | string | Last updater; may be empty if never updated. |
| content.createAt | integer | Creation time in Unix seconds. |
| content.updateAt | integer | Last update time in Unix seconds. |
| content.deleteAt | integer | Deletion time in Unix seconds; -1 if not deleted. |
| content.workspaceUUID | string | Workspace to which the level belongs. |
| content.name | string | Custom level name. |
| content.color | string | Color display value, usually #RRGGBB; the server does not guarantee color format validation. |
| content.description | string | Level description. |
| content.extend | JSON or null | Extension saved on creation; defaults to {} if omitted; an explicit null can be saved; the modification endpoint currently ignores this field. |
| content.extend.custom field | JSON | Dynamic business extension saved by the caller; it is not an additional control parameter. |
| content.isManage | boolean | false for levels created in this workspace; backend global levels are not modified by this module. |
| content.old_name | string | Name before this modification; returned even if the name was not changed. |
| content.declaration | object | Shared declaration for the current workspace. |
{
"code": 200,
"content": {
"id": 123,
"uuid": "issl_example",
"status": 0,
"creator": "wsak_example",
"updator": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427260,
"deleteAt": -1,
"workspaceUUID": "wksp_example",
"name": "P3-轻微",
"color": "#6C7AEB",
"description": "更新后的判定说明",
"extend": {},
"isManage": false,
"declaration": {},
"old_name": "P3-轻微"
},
"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 | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a 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 files have format errors | Submit an object. |
| 404 | ft.ObjectNotExists | The undeleted custom level was not found in the current workspace | The specified object does not exist | Get the uuid of an item with isDefault=false from the workspace list. |
| 406 | ft.IssueLevelNameExists | The modified name duplicates another active custom level | The level name already exists | Choose an unused name. |
| 500 | ft.InternalServerError | Database, configuration/identity format, or unhandled system exception | Internal error | For reads, retry with backoff; for writes, first read back the configuration/level list to verify whether it was saved, then decide whether to retry. |