Create Incident Comment¶
POST /api/v1/incidents/comment/{incident_uuid}/add
Overview¶
Add a comment to the specified incident and notify asynchronously.
Before You Call & Usage Steps¶
The current Key requires incidents.incidentsReplyManage, and the current workspace only. For the path incident_uuid, first use Incident Details to confirm that the target exists in the current workspace and has not been deleted. This endpoint saves the comment first, and only afterwards queries the incident and sends the asynchronous notification; an invalid incident UUID is not guaranteed to be rejected by an upfront existence check, so an orphan comment may be created first and a 500 returned afterwards—therefore you cannot use this endpoint to verify whether an incident exists. When creating a comment, if the incident already has an assignee, the notification candidates are the assignee plus valid @ emails; if there is no assignee, only valid @ emails are used; if neither exists, no notification may be sent. reply currently does not automatically fall back to notification by matching schedules. Asynchronous channels/mute and other conditions still affect actual delivery; a success response does not guarantee reachability.
Attachment UUIDs are obtained by uploading through this module; this binding appends/rebinds, and omitting it or passing [] does not unbind; existing attachments must be removed with Delete Attachment as a separate operation. Comment/attachment/notification are submitted in separate steps, so a 500/timeout may still have saved the comment or attachment; first read back with pagination and verify by body, creator, and time to avoid duplicate comments and notifications. Comment creation has no idempotency key, and repeated modification submissions also update the time. The response contains only the comment entity and the public declaration, not the summary of the newly bound attachments; read attachments and identity through the comment list.
Route Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| incident_uuid | string | Y | UUID of the incident in the current workspace; not an alert event ID, SLO UUID, or comment UUID. Allows null: False Example: incident_exampleHow to obtain or fill in: Get content.data[].uuid from Incident List. |
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential of the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from the API Key management of the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| attachmentUUIDs[*] | string | A single attachment UUID string. Example: att_exampleHow to obtain or fill in: First use Attachment Upload to obtain content.attachmentUuid, and confirm the attachment ownership. |
|
| extend.members | array | Optional account mention array; when creating a comment, accounts with type=@ and a uuid are filtered, their email addresses collected and deduplicated; the account lookup is not constrained again by workspace, so the caller must use verified members of the current workspace; delivery is not guaranteed. Modification computes candidates but currently does not deliver the corresponding email notifications. Example: [{"type": "@", "uuid": "acnt_example", "exists": true}]How to obtain or fill in: Get the account UUID from the current workspace member list, then construct it according to the editor mentions. |
|
| extend.members[*] | object | A mention object; an arbitrary email address cannot be used instead of uuid. Example: {"type": "@", "uuid": "acnt_example", "exists": true}How to obtain or fill in: Same source as members. |
|
| extend.members[*].type | string | Only @ enters the additional email candidates; other types do not. Example: @How to obtain or fill in: Account mention marker from the editor. |
|
| extend.members[*].uuid | string | UUID of a non-deleted account; if there is no corresponding account, it does not enter the email candidates. Example: acnt_exampleHow to obtain or fill in: Account UUID from the current workspace Member List. |
|
| extend.members[*].exists | boolean | Optional compatibility flag; the current notification logic does not rely on it for existence determination. Example: trueHow to obtain or fill in: Filled in by the caller's editor based on the member existence status. |
|
| extend.linkList | array | Array of display links; this interface does not access/validate the targets. Example: [{"name": "排查手册", "link": "https://example.com/runbook"}]How to obtain or fill in: Fill in the related document links. |
|
| extend.linkList[*] | object | A link object. Example: {"name": "排查手册", "link": "https://example.com/runbook"}How to obtain or fill in: Same source as linkList. |
|
| extend.linkList[*].name | string | String display name. Example: 排查手册How to obtain or fill in: Fill in the link display name. |
|
| extend.linkList[*].link | string | URL string. Example: https://example.com/runbookHow to obtain or fill in: Fill in an address accessible to the customer. |
|
| extend.manager | array | Array of historical external assignee emails, kept only for compatibility with the legacy managerInfos; it does not replace the incident assignee configuration. Example: ["xxx@guance.com"]How to obtain or fill in: From the existing extend.manager of the legacy comment; read the original value before modifying. |
|
| extend.manager[*] | string | A single historical email address. Example: xxx@guance.comHow to obtain or fill in: Existing manager array. |
|
| extend.extra | object | Optional object; if a legacy creator exists, the old value is copied to avoid overwriting it. Do not put passwords/tokens into this public extension. Example: {}How to obtain or fill in: Existing extra auxiliary data of the legacy comment. |
|
| extend.extra.creator | object | Historical auxiliary identity; on modification an existing legacy creator takes precedence, and the actual comment creation Key identity cannot be rewritten. Example: {}How to obtain or fill in: Legacy extra.creator data. |
|
| extend.extra.managerInfos | object | Mapping from email addresses to identity objects; when no valid new mapping is provided, only the legacy entries that still appear in the manager array are retained. Example: {}How to obtain or fill in: Legacy extra.managerInfos mapping. |
|
| comment | string | Y | Required string; the current declaration does not enforce non-emptiness, so provide meaningful content and do not use an empty string as a substitute for deletion. Allows null: False Example: 已确认数据库连接异常,正在处理。How to obtain or fill in: Filled in by the current handler with the incident progress. |
| extend | json | Must be a JSON object; on creation omit or use {}, on modification omitting keeps it, and when present it is replaced as a whole ({} clears it, but the legacy extra.creator/managerInfos are retained for compatibility). A root parameter of null/array/string is rejected by the public route with 406 first. Internal members:null, a non-object member, or extra:null and other undeclared substructures may cause a 500, so fill in according to the sub-field structures in this document. Allows null: False Example: {"members": [{"type": "@", "uuid": "acnt_example", "exists": true}], "linkList": [{"name": "排查手册", "link": "https://example.com/runbook"}]}How to obtain or fill in: Constructed by the caller's editor, retaining the mentions and links that need to be displayed. |
|
| attachmentUUIDs | array | Omitting it binds nothing; when present, each item is appended/rebound to the comment, and [] does not clear existing attachments. Invalid/deleted UUIDs may cause a 500; the binding is committed internally, so it may already be saved even if a later step fails. Use only valid attachments that you have verified yourself; do not borrow attachments of other resources. Allows null: False Example: ["att_example"]How to obtain or fill in: First use Attachment Upload to obtain content.attachmentUuid, and confirm the attachment ownership. |
Additional Parameter Notes¶
Attachments are first uploaded through this module's attachmentUpload, and then content.attachmentUuid is passed into attachmentUUIDs. extend.members mentions by account UUID; adding a comment dispatches a notification, while modifying a comment currently does not resend that mention notification.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/incidents/comment/incident_example/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"comment":"已确认数据库连接异常,正在处理。"}'
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, and a pre-submission snapshot may be null. |
| content.uuid | string | UUID of this resource. |
| content.status | integer | Database status, 0 active/3 deleted; different from the incident business status incidentsStatus. |
| content.creator | string | Creation principal; for an API Key it is generally wsak_resource UUID. |
| content.updator | string | Most recent update principal; may be empty if never updated. |
| content.createAt | integer | Creation time in Unix seconds. |
| content.updateAt | integer | Most recent update time in Unix seconds. |
| content.deleteAt | integer | Deletion time in Unix seconds; -1 if not deleted. |
| content.incidentsUUID | string | UUID of the incident it belongs to. |
| content.workspaceUUID | string | Workspace it belongs to. |
| content.comment | string | Comment body, which may contain system-generated operation descriptions; do not treat the body as a structured operation record. |
| content.extend | object or JSON | Saved extension; system comments may contain operator/operator_info/operate_type/before/after, etc. |
| content.extend.members | array<object> |
@member input records, used as additional email notification candidates when creating a comment; they do not mean delivered. |
| content.extend.members[].type | string | @ indicates an account mention; other values do not enter that email candidate set. |
| content.extend.members[].uuid | string | Account UUID. |
| content.extend.members[].exists | boolean | Customer editor status; server-side notification filtering does not rely on this value. |
| content.extend.linkList | array<object> |
Business link display data. |
| content.extend.linkList[].name | string | Link display name. |
| content.extend.linkList[].link | string | Link URL. |
| content.extend.manager | array<string> |
Array of historical external assignee emails, used for filtering when the legacy extra.managerInfos is retained on modification; not equivalent to the incident assigner. |
| content.extend.manager[] | string | A single historical assignee email. |
| content.extend.extra | object | Auxiliary external identity data; modification may retain the original creator and the managerInfos still present in manager. |
| content.extend.extra.creator | JSON | Auxiliary identity data of the original creator; if the legacy value exists, modification cannot use it to rewrite the creator. |
| content.extend.extra.managerInfos | object | Dynamic mapping from historical assignee emails to identity data. |
| content.extend.extra.managerInfos.email | JSON | The original identity data corresponding to that email. |
| content.extend.operator | string | Original operator principal identifier of a system operation comment. |
| content.extend.operator_info | object | Principal summary attached to a system operation comment. |
| content.extend.operate_type | string | Operation type attached to a system operation comment. |
| content.extend.before | JSON | Old value of the system operation; varies by action. |
| content.extend.after | JSON | New value of the system operation; varies by action. |
| content.extend.custom fields | JSON | Other extension key-values saved by the caller/system; this interface does not guarantee a fixed structure. |
| content.extend.operator_info.uuid | string | Principal UUID; for system replies the principal may be empty or a system identifier. |
| content.extend.operator_info.status | integer | Principal status. |
| content.extend.operator_info.wsAccountStatus | integer | Workspace member status; for a Key it takes the Key status, not the incident status. |
| content.extend.operator_info.username | string | Login name/Key name/system name. |
| content.extend.operator_info.name | string | Display name; the system AI display name uses the site configuration. |
| content.extend.operator_info.iconUrl | string | Avatar URL; may be omitted in system summaries. |
| content.extend.operator_info.email | string | Contact email; for a Key summary it may be the Key UUID rather than a deliverable email address. |
| content.extend.operator_info.mobile | string | Contact mobile number; may be empty. |
| content.extend.operator_info.countryCode | string | Country code; may be omitted in system summaries. |
| content.extend.operator_info.acntWsNickname | string | Workspace nickname; may be omitted in system summaries. |
| content.declaration | object or null | Public declaration of the workspace attached to non-empty content; may be null or an empty object when not configured; an empty content object is not added. |
{
"code": 200,
"content": {
"id": 123,
"uuid": "inccmt_example",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"incidentsUUID": "incident_example",
"workspaceUUID": "wksp_example",
"comment": "已确认数据库连接异常,正在处理。",
"extend": {},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
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 | The request JSON syntax is invalid | Request JSON format error | Fix 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 an object. |
| 500 | ft.InternalServerError | Database, cache/queue, invalid attachment, unexpanded sub-field type/legacy abnormal structure, or unhandled downstream exception | Internal error | Read-only requests can be retried with backoff; for write requests, first read the current state of the incident/comment and the notification records, since the submission may already have succeeded, to avoid duplicate creation or duplicate notifications. |