
# 创建句子
#### 场景描述
创建句子的接口。
#### 接口方法
POST
#### 接口URI
https://域名/apiaccess/CCSQM/rest/ccisqm/v1/sentencemanage/createSentence，例如域名是service.besclouds.com
#### 请求说明
表1请求头参数 
| 序号 | 名称            | 参数类型   | 是否必选  | 说明                                                                                                                                         |
|:---|:---|:---|:---|:---|
| 1  | Content-Type  | string | False | 固定填 application/json;charset=UTF-8。                                                                                                        |
| 2  | x-app-key     | string | False | appKey标识                                                                                                                                   |
| 3  | Authorization | string | True  | 鉴权字段，内容格式为: Bearer +tokenByAKSK接口的返回值中AccessToken（Bearer后有空格）                                                                              |
| 4  | x-UserId      | string | False | 操作员标识 可在登录后，进入员工管理页面，查看接口返回的userId |
   
表2请求体参数 
| 序号      | 名称            | 参数类型            | 是否必选  | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|:---|
| 1.1     | category_id   | string          | True  | 句子分类的唯一标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 1.2     | sentence_name | string          | True  | 句子名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 1.3     | tagDataList   | array\[object\] | True  | 句子使用到的语义与关键词                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 1.3.1   | tag_type      | string          | True  | 标签类型，取值范围： - keyword：关键字  - dialogue_act：语料  - regular_exp：正则表达式   |
| 1.3.2   | pos_sentences | array\[object\] | False | 正义语料，关键字，或正则表达式内容                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 1.3.2.1 | name          | string          | False | 正义语料内容                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 1.3.3   | neg_sentences | array\[object\] | False | 反义语料                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 1.3.3.1 | name          | string          | False | 反义语料内容                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
   
#### 响应说明
- **响应状态码: 200**
表3响应体参数 
| 序号  | 名称          | 参数类型   | 是否必选  | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|:---|
| 1.1 | sentence_id | string | False | 句子标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 1.2 | id          | string | False | 句子标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 1.3 | resultCode  | string | False | 返回码 - 0403000 表示成功  - 其他表示失败   |
| 1.4 | resultDesc  | string | False | 返回描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 1.5 | statusCode  | number | False | 状态码                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   
- **响应状态码: 400**
  错误的请求：请检查请求路径及参数。
  
- **响应状态码: 401**
  未授权：1. 请确认是否购买了相关服务。 2. 请联系客服人员检查您账号的当前状态。
  
- **响应状态码: 404**
  请求的内容未找到：请检查请求的路径。
  
- **响应状态码: 500**
  业务失败：请依次确认您请求中各参数的取值。
  
 
#### 错误码
无。
#### 报文样例
- 场景描述：创建句子 请求头:
  ```
  x-app-key:************************************  
  X-UserID:1611917095665261978  
  Authorization:Bearer ********************************
  ```
  请求参数:
  ```
  {
    "category_id": "1070149256381206528",
    "sentence_name": "句子名称87",
    "tagDataList": [
      {
        "tag_type": "dialogue_act",
        "pos_sentences": [
          {
            "name": "同义语料88"
          }
        ],
        "neg_sentences": [
          {
            "name": "反义语料28"
          }
        ]
      },
      {
        "tag_type": "keyword",
        "pos_sentences": [
          {
            "name": "关键字11192"
          },
          {
            "name": "关键字22222"
          }
        ]
      },
      {
        "tag_type": "regular_exp",
        "pos_sentences":[{
             "name": "正则表达式2221"
         }]
       }
    ]
  }
  ```
  响应参数:
  ```
  {
      "sentence_id": "10849",
      "resultCode": "0403000",
      "id": "10849",
      "resultDesc": "操作成功"
  }
  ```
  
 
