
# 创建任务
#### 场景描述
创建任务接口。
#### 接口方法
POST
#### 接口URL
https://域名/service/AICC__Case/1.0.0/openapi/task，例如域名是service.besclouds.com。
#### 请求说明
表1请求头参数 
| 序号 | 名称           | 参数类型   | 是否必选 | 说明                                                                                                                                                                                            |
|:---|:---|:---|:---|:---|
| 1  | Content-Type | string | True | 消息正文的类型为JSON                                                                                                                                                                                  |
| 2  | access-token | string | True | 用户访问租间token，参见[调用鉴权接口](https://support.huaweicloud.com/api-ccfs-cec/cec_07_0260.html#ZH-CN_TOPIC_0000002481273558__zh-cn_topic_0000002509989463_zh-cn_topic_0000001629993164_li1537163311381) |
   
表2请求体参数 
| 序号 | 名称       | 参数类型     | 长度（字节） | 是否必选 | 说明                                                                                                                                  |
|:---|:---|:---|:---|:---|:---|
| 1  | taskInfo | TaskInfo | -      | True | 任务详情信息，该对象的参数说明请参见[表3] |
   
 表3TaskInfo任务详情参数说明 
| 序号 | 名称          | 参数类型     | 长度（字节） | 是否必选  | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|:---|:---|:---|
| 1  | title       | string   | 128    | True  | 任务标题                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 2  | description | string   | 20000  | False | 任务描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 3  | type        | string   | -      | False | 任务关联类型 取值： - Case                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 4  | relateId    | string   | 20     | False | 如果关联任务类型有值，这里也必须有值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 5  | ownerId     | string   | 20     | True  | 处理人id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 6  | contactId   | string   | 20     | False | 联系人id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 7  | creatorId   | string   | 20     | True  | 创建人id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 8  | priority    | string   | 128    | False | 优先级 取值： - Critical，映射前台页面紧急状态。  - High  - Medium  - Low   |
| 9  | dueDate     | DateTime | -      | False | 期望完成时间，格式为YYYY-MM-DD HH:mm:ss                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 10 | attachment  | string   | 255    | False | 任务附件                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   
#### 响应说明
- **响应状态码: 200**
表4响应体参数 
| 序号 | 名称     | 参数类型   | 是否必选 | 说明   |
|:---|:---|:---|:---|:---|
| 1  | taskId | string | True | 任务id |
   
#### 消息样例
场景描述：创建任务
URL：https://域名/service/AICC__Case/1.0.0/openapi/task
- 请求头:
```
{
 "Content-Type": "application/json",
 "access-token": "0000000000************7bm63KsRmEztTvyA="
}
```
- 请求体：
```
{
"taskInfo":{
    "title": "test002",
    "description": "test001",
    "type": "Case",
    "ownerId": "10gg00000148QvgpaLAm",
    "relateId": "c6m80000014iXKHqDw3c",
    "dueDate": "2023-07-08 00:00:00",
    "contactId": "ciIy0000013y7cC8T2rA",
    "priority": "Low",
    "creatorId": "10gg00000148QvgpaLAm"
    }
}
```
- 响应头：
```
{ "connection": "keep-alive",
 "Content-Length": "16",
"Content-Type": "application/json%3Bcharset=UTF-8"}
```
- 响应参数：
```
{
  "resCode": "0",
  "resMsg": "成功",
  "result": {"taskId":"ccqG0000014iXvGKONQO"}
}
```
