Create Issue Channel¶
POST /api/v1/channel/add
Overview¶
Create an Incident channel and configure notification targets and escalation notifications.
Before Calling and Usage Steps¶
First, confirm the name through the Channel Quick List. A name is the minimum required to create a channel. Avoid using default as the name. If notifications need to be sent, prepare a real notification target UUID first; the example only creates a channel, and when configuring notifications, submit the complete fields separately according to the parameter table. The channel and escalation trigger configuration are saved in separate steps. After a timeout or error, query the channel status first, then decide which fields to retry to avoid duplicate creation. Escalation notifications apply to Issues that are created after the rule is enabled or updated, remain unresolved, and have no assignee. After triggerTime is exceeded, a scheduled task checks them; this is not a precise countdown. The current task also depends on a valid unassigned escalation notification policy in the workspace; if no message is received, check the notification policy, notification targets, and site task switch.
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 the required permissions from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| notifyTarget[*] | string | A single notification target UUID. Example: notify_exampleHow to obtain or enter: Use the Notification Target List to query notification targets configured in the same workspace and take content.data[].uuid. |
|
| notifyUpgradeCfg.notifyTarget[*] | string | A single escalation notification target UUID. Example: notify_exampleHow to obtain or enter: Use the Notification Target List to query notification targets configured in the same workspace and take content.data[].uuid. |
|
| name | string | Y | Channel name, maximum 256 characters. Allows null: False Maximum length: 256 Example: 生产异常How to obtain or enter: Check existing names in the Channel Quick List, then choose a name that is not already used in this workspace. |
| description | string | Channel description, maximum 256 characters. Allows null: False Allows empty string: True Maximum length: 256 Example: 生产异常协作频道How to obtain or enter: Enter a description based on the channel's purpose. Pass an empty string to clear it. |
|
| notifyTarget | array | Complete notification target UUID array; pass [] to clear the configuration. Allows null: False Example: ["notify_example"]How to obtain or enter: Use the Notification Target List to query notification targets configured in the same workspace and take content.data[].uuid. |
|
| notifyUpgradeCfg | json | Complete escalation notification configuration; if this object is passed, both triggerTime and notifyTarget must be provided. Allows null: False Example: {"triggerTime": 300, "notifyTarget": ["notify_example"]}How to obtain or enter: Choose the number of seconds based on the business wait time, and use real notification target UUIDs. |
|
| notifyUpgradeCfg.triggerTime | integer | Conditionally required | Number of seconds to wait before escalation notification; when non-zero, at least one notification target is also required to enable the rule. Allows null: False Example: 300How to obtain or enter: Enter a positive integer number of seconds; for example, 300 means waiting 5 minutes. To disable, pass 0 together with an empty notifyTarget array. |
| notifyUpgradeCfg.notifyTarget | array | Conditionally required | Complete list of escalation notification target UUIDs; combine with triggerTime=0 to disable. Allows null: False Example: ["notify_example"]How to obtain or enter: Use the Notification Target List to query notification targets configured in the same workspace and take content.data[].uuid. |
Additional Parameter Notes¶
notifyUpgradeCfg creates an escalation trigger configuration only when both a non-zero triggerTime and a non-empty notifyTarget are provided.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/channel/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"生产异常","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 record ID. During creation, the response is constructed before persistence, so this value may be null; use uuid to operate on the resource. |
| content.uuid | string | Channel UUID, used for modification, deletion, or subscription. |
| content.workspaceUUID | string | Workspace to which the channel belongs. |
| content.name | string | Channel name. default indicates the default channel. |
| content.description | string | Channel description. |
| content.notifyTarget | array<string> |
Notification target UUIDs configured directly for this channel. |
| content.notifyTarget[] | string | A single notification target UUID. |
| content.notifyUpgradeCfg | object | Escalation notification configuration; empty object when not configured. |
| content.notifyUpgradeCfg.triggerTime | integer | Wait duration before triggering an escalation notification, in seconds. |
| content.notifyUpgradeCfg.notifyTarget | array<string> |
List of escalation notification target UUIDs. |
| content.notifyUpgradeCfg.notifyTarget[] | string | Escalation notification target UUID. |
| content.status | integer | Record status; 0 indicates normal. |
| content.creator | string | Creation call identity. |
| content.updator | string | Identity of the most recent update; may be an empty string if not updated. |
| content.createAt | integer | Creation time, in Unix seconds. |
| content.updateAt | integer | Update time, in Unix seconds; -1 if not updated. |
| content.deleteAt | integer | Deletion time, in Unix seconds; -1 if not deleted. |
| content.declaration | object or null | Public declaration of the workspace. |
{
"code": 200,
"content": {
"id": null,
"uuid": "chan_example",
"workspaceUUID": "wksp_example",
"name": "生产异常",
"description": "生产异常协作频道",
"notifyTarget": [],
"notifyUpgradeCfg": {},
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"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 a field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | 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 | Partial JSON file format error | Pass a single JSON object. |
| 400 | ft.ChannelNameRepeat | A channel with the same name exists, or a concurrent creation with the same name is being processed | Channel name already exists | Check the current channel list first; for concurrent creation, wait briefly, then confirm whether a retry is needed. |
| 400 | ft.InvalidChannelName | name is default during creation | Using default as the channel name is prohibited | Use a custom channel name instead. |