回复 创建¶
POST /api/v1/issue/reply/create
概述¶
为Issue创建普通回复,可同时绑定已上传附件、追加频道并@成员。
调用前和使用步骤¶
先确认Issue 详情中的目标Issue。issueUUID与extend必填,无扩展内容传{}。附件先上传,回复创建时再提交attachmentUuids绑定。extend.channels会追加合并到Issue已有频道,不会只绑定到本条回复;members用于本次@通知。成功返回回复uuid,后续可查回复列表。接口成功不等于通知送达。通知异步执行,接收人取决于频道订阅、通知对象、通知策略、负责人和本次 @ 成员;请在控制台核对通知配置及实际送达。写入和后续通知、附件处理分步执行,失败或超时后先查询资源是否已创建或更新,再决定重试,避免重复记录与通知。
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI 鉴权凭据。 例子: <DF-API-KEY>获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。 |
Body 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| attachmentUuids[*] | json | 单个已上传附件UUID。 例子: att_example获取或填写方式: 取上传附件的content.attachmentUuid。 |
|
| extend.text | json | 可选纯文本,用于服务端长度检查,最多3000字符。 例子: 定位生产接口延迟。获取或填写方式: 从描述的纯文本中提取,控制在3000字符内;省略则按空文本检查。 |
|
| extend.channels | array | 频道引用数组;追加合并已绑定频道,[]不会清空旧绑定。 例子: [{"type": "#", "uuid": "chan_example", "name": "生产异常"}]获取或填写方式: 从频道列表取得真实频道UUID,引用描述中的 # 频道。省略不追加。 |
|
| extend.channels[*] | json | 频道引用对象。 例子: {"type": "#", "uuid": "chan_example", "name": "生产异常"}获取或填写方式: 每项选择同空间的一个实际频道。 |
|
| extend.channels[*].uuid | json | 频道UUID。 例子: chan_example获取或填写方式: 从频道列表的content[].uuid取得。 |
|
| extend.channels[*].name | json | 客户端显示名称。 例子: 生产异常获取或填写方式: 从频道列表取对应name,用于显示;可省略。 |
|
| extend.channels[*].type | json | 频道引用标记。 例子: #获取或填写方式: 频道引用固定使用 #;服务端读取结果会补充该标记。 |
|
| extend.channels[*].exists | json | 可选显示标记,不替代服务器的资源校验。 例子: true获取或填写方式: 不必作为有效性凭据传入;查询响应按当前资源存在性重新计算。 |
|
| extend.members | array | 本次@成员引用,用于收集一次性通知邮箱;不是负责人数组。 例子: [{"type": "@", "uuid": "acnt_example", "name": "值班工程师"}]获取或填写方式: 从目标工作空间成员管理取得账号UUID;省略不追加本次@成员。 |
|
| extend.members[*] | json | 成员引用对象。 例子: {"type": "@", "uuid": "acnt_example", "name": "值班工程师"}获取或填写方式: 为每个需要@的账号填写对象。 |
|
| extend.members[*].uuid | json | 成员账号UUID。 例子: acnt_example获取或填写方式: 从目标工作空间成员管理取得 acnt_ 账号UUID。 |
|
| extend.members[*].name | json | 客户端显示名称。 例子: 值班工程师获取或填写方式: 使用成员显示名;可省略。 |
|
| extend.members[*].type | json | 成员引用标记。 例子: @获取或填写方式: 成员引用使用 @。 |
|
| extend.members[*].exists | json | 可选显示标记。 例子: true获取或填写方式: 不必作为有效性凭据传入,查询时重新计算。 |
|
| extend.extra | json | 外部显示信息,不会替换API实际鉴权/作者身份。 例子: {}获取或填写方式: 第三方集成需要显示外部操作人时填写;没有时省略或 {}。 |
|
| extend.extra.creator | json | 创建人显示对象。 例子: {"name": "外部工单创建人", "email": "xxx@guance.com"}获取或填写方式: 来自集成系统的创建人;修改时原有creator通常由服务端保留。 |
|
| extend.extra.creator.name | json | 显示名,可省略。 例子: 外部工单创建人获取或填写方式: 取外部系统显示名称。 |
|
| extend.extra.creator.email | json | 显示邮箱,可省略。 例子: xxx@guance.com获取或填写方式: 取外部系统邮箱,示例为虚构地址。 |
|
| extend.extra.updator | json | 更新人显示对象。 例子: {"name": "外部工单更新人", "email": "xxx@guance.com"}获取或填写方式: 修改时取集成系统本次操作人信息。 |
|
| extend.extra.updator.name | json | 显示名,可省略。 例子: 外部工单更新人获取或填写方式: 取外部系统显示名称。 |
|
| extend.extra.updator.email | json | 显示邮箱,可省略。 例子: xxx@guance.com获取或填写方式: 取外部系统邮箱。 |
|
| issueUUID | string | Y | 回复所属Issue UUID,必填。 允许 null: False 例子: issue_example获取或填写方式: 从Issue 列表或Issue 详情取得uuid。 |
| attachmentUuids | array | 可选已上传附件UUID数组,非空时绑定或重新绑定到本条回复;省略或[]不会删除旧附件。 允许 null: True 例子: []获取或填写方式: 先调用上传附件,保存content.attachmentUuid;只能使用本空间实际上传且可用的附件。省略或[]不新增附件。 |
|
| content | string | 回复内容;创建最多65535长度单位:ASCII及半角片假名每字符计1,其余如汉字通常计2;空白内容计0。省略默认为空字符串。 允许 null: True 允许空字符串: True $maxCustomLength: 65535 例子: 已定位到数据库慢查询,正在优化。获取或填写方式: 填写处理进展;纯附件回复可省略或传空字符串。 |
|
| extend | json | Y | 必填扩展对象,无内容传 {},勿传 null。 允许 null: True 例子: {}获取或填写方式: 没有扩展内容时传 {};修改前先读取原值,并在完整对象中调整需要变更的字段。 |
参数补充说明¶
本接口未在创建前返回稳定的“Issue不存在”业务错误,请先确认目标Issue存在。没有有效内容或附件的空回复也可能创建成功;客户端应按业务需求检查。
请求例子¶
curl --request POST 'https://openapi.guance.com/api/v1/issue/reply/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"issueUUID":"issue_example","content":"已定位到数据库慢查询,正在优化。","extend":{}}'
响应¶
HTTP 200,application/json。下方示例展示可直接读取的主要字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.id | integer 或 null | 记录编号。创建Issue/回复的响应在持久化前构造时可能为 null,操作资源请使用 uuid。 |
| content.uuid | string | 资源 UUID。 |
| content.workspaceUUID | string | 所属工作空间 UUID。 |
| content.status | integer | 记录状态;0 正常,3 已删除。与Issue业务状态 statusType 区分。 |
| content.creator | string | 创建调用身份,可能为 API Key 标识、账号或系统身份。 |
| content.updator | string | 最近更新身份;未设置时为空字符串。 |
| content.createAt | integer | 创建时间,Unix 秒。 |
| content.updateAt | integer | 最近更新时间,Unix 秒;未更新时可为 -1。 |
| content.deleteAt | integer | 删除时间,Unix 秒;未删除时为 -1。 |
| content.issueUUID | string | 所属Issue UUID。 |
| content.content | string 或 null | 回复或操作记录的内容。 |
| content.type | string | reply普通回复,change操作记录,eventReply关联事件回复,autoDiscoveryReply自动发现回复。 |
| content.extend | object | 扩展内容。请求应传对象 {},不要传 null;成员、频道及负责人等结构见参数表。 |
| content.extend.text | string | 用于长度检查的纯文本,最多 3000 字符。 |
| content.extend.channels | array<object> |
描述中引用的频道,含 uuid、name、type、exists;返回时 exists 按当前资源存在性刷新。 |
| content.extend.channels[].uuid | string | 频道 UUID。 |
| content.extend.channels[].name | string 或 null | 显示名称。 |
| content.extend.channels[].type | string | 频道引用标记 #。 |
| content.extend.channels[].exists | boolean | 返回时该频道是否存在。 |
| content.extend.members | array<object> |
描述中 @ 的成员引用,含 uuid、name、type、exists。 |
| content.extend.members[].uuid | string | 成员账号 UUID。 |
| content.extend.members[].name | string 或 null | 显示名称。 |
| content.extend.members[].type | string | 成员引用标记 @。 |
| content.extend.members[].exists | boolean | 返回时该账号是否存在。 |
| content.extend.extra | object | 第三方对接显示信息,不改变API实际鉴权身份。 |
| content.extend.extra.creator | object | 第三方创建人显示信息,可包含 name、email。 |
| content.extend.extra.creator.name | string | 创建人显示名称。 |
| content.extend.extra.creator.email | string | 创建人显示邮箱。 |
| content.extend.extra.updator | object | 第三方更新人显示信息,可包含 name、email。 |
| content.extend.extra.updator.name | string | 更新人显示名称。 |
| content.extend.extra.updator.email | string | 更新人显示邮箱。 |
| content.extend.extra.managerInfos | object | 以负责人邮箱为键的显示信息映射,仅Issue使用。 |
| content.extend.extra.managerInfos.邮箱.name | string | 对应邮箱负责人的显示名称。 |
| content.extend.其他字段 | JSON | 客户端保存的其他扩展信息;不代表都会触发业务行为。 |
| content.declaration | object 或 null | 工作空间公共声明;仅content本层附加。 |
{
"code": 200,
"content": {
"id": null,
"uuid": "repim_example",
"workspaceUUID": "wksp_example",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785430800,
"updateAt": -1,
"deleteAt": -1,
"issueUUID": "issue_example",
"content": "已定位到数据库慢查询,正在优化。",
"type": "reply",
"extend": {},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 请求字段缺失,或字段值违反声明的校验条件 | 参数解析失败 | 核对参数位置、字段名、类型和取值。 |
| 400 | ft.RequestJsonFormatError | 请求 JSON 语法无效 | 请求 JSON 格式错误 | 按 content.reason、line、column 修正 JSON。 |
| 400 | ft.JsonFormatError | JSON 顶层不是对象 | 部分 json 文件格式错误 | 提交 JSON 对象。 |
| 406 | ft.ExceedMaxLengthLimit | extend.text 的长度超过 3000 个字符 | 超过文本最大长度限制 | 缩短纯文本字段;将大段诊断资料作为附件上传。 |
| 500 | ft.InternalServerError | 等级或配置保存、审计或其他内部处理失败 | 内部错误 | 先读取当前等级或配置确认结果,再决定重试;持续失败时提供traceId。 |