创建工单请求
POST /apiv2/requests.json
调用权限
end user
请求参数
Name | Type | Required | Description |
---|---|---|---|
title | string | yes | 标题 |
comment | object | yes | 工单描述 |
priority | string | no | 可选值:"low", "medium", "high", "urgent" |
custom_fields | array | no | 工单自定义字段 |
template_id | integer | no | 工单模板ID |
curl 示例
curl https://{subdomain}.kf5.com/apiv2/requests.json \ -d '{"request": {"title": "Help!", "comment": {"content": "My new requests", "uploads": ["00156a9d6e82efefcbbd874ffbf617e","00156a9d6e82efefcbbd874ffbf617e"]}}}' \ -v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
有自定义字段内容的创建工单示例请求
{ "request":{ "title": "Let's create ticket", "comment": { "content": "what are you waiting for?" }, "custom_fields": [{"name": "field_123", "value": "test"},{"name": "field_567", "value": "world"} } }
设置自定义字段
Note: 请注意自定义字段的类型验证规则,想了解更多请看 工单自定义字段接口 Ticket Fields API
"custom_fields": [{"name": "field_123", "value": "test"}, ...]
上传工单附件
在创建或者更新工单时,可以给工单回复添加附件。首先需要调用 Attachments API 里的上传附件接口, 成功后会返回附件token,然后将token添加到comment里的uploads数组里,这样工单回复在保存时就能把附件给关联上。
"comment": { "content": "with attachments", "uploads": ["00154af5872418a7792dda", ...]}
返回示例
Status: 201 Created Location: https://{subdomain}.kf5.com/apiv2/requests/{id}.json{ "request": { "id": 33, "status": "open", "title": "My new requests", ... }}