更新时间:2023-12-18 GMT+08:00
示例一:创建工单
场景描述
本章节指导用户通过API创建工单。API的调用方法请参见如何调用API。
涉及接口
- 获取IAM用户Token(使用密码):用于鉴权认证。
- 上传附件:针对有附件的提单场景,通过该接口上传附件。
- 创建工单:提交工单。
- 查询工单详情:根据工单id查询工单的进展和详情。
前提条件
- 已获取目的端AK/SK,参见创建访问密钥(AK/SK)。
操作步骤
- 获取IAM用户Token。
- 接口相关信息
详情请参见获取IAM用户Token(使用密码)。
- 请求示例
POST: https://{iam_endpoint}/v3/auth/tokens
{endpoint}信息请从地区和终端节点获取。
Body:{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "domain": { "name": "domainname" }, "password": "****" } } }, "scope": { "project": { "id": "****" } } } }
响应Header中“X-Subject-Token”的值即为Token:
X-Subject-Token:MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...
- 接口相关信息
- 上传附件。
- 接口相关信息
POST /v2/servicerequest/accessorys/json-format-content
详情请参见上传附件接口。
- 请求示例
POST https://osm.cn-south-1.myhuaweicloud.com/v2/servicerequest/accessorys/json-format-content
Header:
Content-Type: application/json X-Auth-Token: "Token"
Body:
{ "accessory_name": "filename", "accessory_from": "incident", "upload_type": 0, "accessory_data": "Base64 XXXXX" }
- 响应示例
{ "accessory_id": "accessory_id" }
- 接口相关信息
- 调用创建工单接口创建工单。
- 接口相关信息
POST /v2/servicerequest/cases
详情请参见创建工单。
- 请求示例
POST https://osm.cn-south-1.myhuaweicloud.com/v2/servicerequest/cases
Header:
Content-Type: application/json X-Auth-Token: "Token"
Body:
{ "business_type_id": "business_type_id", "product_category_id": "product_category_id", "incident_sub_type_id": "1", "source_id": "83aeb0f2834c4df49826c781d32a963e", "simple_description": "test", "remind_time": "0", "region_id": "cn-test-1", "area_code": "86", "extends_map": { }, "extension_map": { }, "accessory_ids": [ "accessory_id" // 这里的id用第三步上传附件返回的id,//如果没有附件,不要传accessory_ids这个参数 ] }
- 响应示例
{ "incident_id": "TS-123456" }
- 接口相关信息
- 调用查询接口,查看工单的详情和进展。
- 接口相关信息
GET /v2/servicerequest/cases/{case_id}
详情请参见查询工单详情接口。
- 请求示例
GET https://osm.cn-south-1.myhuaweicloud.com/v2/servicerequest/cases/TT-123456
Header:
Content-Type: application/json X-Auth-Token: “Token”
- 响应示例
{ "incident_detail_info": { "xcustomer_name": "test", "status": 0, "incident_id": "TT-123456", "business_type_name": "活动规则咨询", "customer_id": "customer_id", "dc_name": "华南-广州", "simple_description": "123", "source_name": "用户中心", "create_time": "2020-12-25T09:24:18Z", "message_list": [ { "type": 0, "replier": "", "content": "123", "message_id": "", "replier_name": "", "create_time": "2020-12-25T09:24:18Z", "is_first_message": 0, "accessory_list": [ { "accessory_id": "", "file_actual_name": "test.jpg" } ] } ], "incident_satisfaction": [ ], "is_authorized": 0, "resolve_time": 0, "business_ownership": 0, "ext_info": { "area_code": "", "remind_mobile": "", "remind_mail": "", "contact_type": "0,1,2", "remind_time": "0", "cc_email": "" } } }
Status 0表示待受理。
- 接口相关信息
父主题: 应用示例