获取常见问题模板列表
请求地址
- GET /v1/robots/:id/commonQuestionModels
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| id | Integer | false | 机器人id. | 
Query parameters
| Parameter | Type | Optional | Description | 
| pageNum | Integer | true | 页码,默认值是1 | 
| pageSize | Integer | true | 每页记录的数量,默认值为20 | 
| searchType | Integer | true | 1.按name字段搜索 2.按modelKey字段搜索 | 
| searchWord | String | true | 搜索关键字 | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码. | 
| message | String | 执行结果说明. | 
| data | Array | 模板列表信息. | 
| data[].id | Integer | 模板id. | 
| data[].robotId | Integer | 机器人id. | 
| data[].name | String | 模板名称. | 
| data[].description | String | 模板描述. | 
| data[].modelKey | String | 模板标识key modelKey(可以在初始化会话时传递). | 
示例
$ curl 'https://km.udesk.cn/api/v1/robots/83/commonQuestionModels?email=admin@udesk.cn×tamp=1540881364&sign=4708c26e84801bf4508a44cfbc110c02dceab794' -i
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : [ {
    "id" : 88,
    "robotId" : 83,
    "name" : "默认推荐1",
    "description" : "默认推荐",
    "modelKey" : "0"
  }, {
    "id" : 69,
    "robotId" : 83,
    "name" : "king",
    "description" : "引导语进入.....",
    "modelKey" : "哎哎哎"
  }, {
    "id" : 118,
    "robotId" : 83,
    "name" : "测试",
    "description" : "dd",
    "modelKey" : "dc"
  } ]
}
请求失败原因
| Message | Description | 
| "Failed to convert value of type 'java.lang.String' to required type 'int' | 整型参数的值异常 | 
获取FAQ问题列表
请求地址
- POST /v1/questions/search
请求参数
Request fields
| Path | Type | Optional | Description | 
| pageNum | Integer | true | 页码,默认值是1. | 
| pageSize | Integer | true | 每页记录的数量,默认值为20. | 
| robotId | Integer | false | 机器人id. | 
| categoryId | Integer | true | 分类id. | 
| searchWord | String | true | 搜索关键词. | 
| searchType | Integer | true | 搜索类型 1:全部问题(问题及相似问法) 2:标准问题(不包含相似问法) 3:答案(默认) 4:全部 | 
| type | Integer | true | 问题类型 1:问题 3:流程 4:闲聊 0:全部(默认) | 
| order | Integer | true | 根据更新时间排序 1:正序(默认)2:倒序. | 
| isWorking | Integer | true | 是否生效 1:全部(默认)2:有效 3:无效. | 
| channelIdList | Array | true | 场景列表. | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码. | 
| message | String | 执行结果说明. | 
| data | Array | 问题列表信息 | 
| data[].id | Integer | 主问题id. | 
| data[].robotId | Integer | 机器人id. | 
| data[].categoryId | Integer | 分类id. | 
| data[].content | String | 问题内容. | 
| data[].type | Integer | 问题类型. | 
| data[].keyword | String | 强制召回词. | 
| data[].suggestType | Integer | 建议类型 1:关闭 2:智能推荐 3:手动推荐. | 
| data[].availableTimeType | Integer | 生效时间 0:表示永久无效 1:表示永久有效 2:表示自定义有效期. | 
| data[].startTime | String | 生效时间. | 
| data[].endTime | String | 失效时间. | 
| data[].createTime | String | 创建时间. | 
| data[].updateTime | String | 更新时间. | 
| data[].answer | Object | 问题答案. | 
| data[].answer.id | Integer | 问题答案ID. | 
| data[].answer.content | String | 答案内容. | 
| data[].answer.type | Integer | 问题答案类型 | 
| data[].suggestList | Array | 问题答案建议列表. | 
| data[].suggestList[].id | Integer | 建议ID. | 
| data[].suggestList[].content | String | 建议内容. | 
示例
$ curl 'https://km.udesk.cn/api/v1/questions/search?email=admin@udesk.cn×tamp=1529402458&sign=29beefc01662bd040a74880346f3da4491a357cf' -i -X POST -H 'Content-Type: application/json' -d '{
  "pageNum" : 1,
  "pageSize" : 10,
  "robotId" : 102,
  "categoryId" : null,
  "searchWord" : "世界",
  "searchType" : 3,
  "type" : 1,
  "order" : 2,
  "isWorking" : 1,
  "channelIdList" : null
}'
返回
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 2
    },
    "data": [
        {
            "id": 8657,
            "robotId": 102,
            "categoryId": 343,
            "content": "世界哪里和平了",
            "type": 1,
            "keyword": "和平",
            "suggestType": 3,
            "availableTimeType": null,
            "startTime": null,
            "endTime": null,
            "createTime": "2018-05-30 17:06:13",
            "updateTime": "2018-10-31 13:57:47",
            "answer": {
                "id": 4442,
                "content": "<p>没有</p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>",
                "type": 2
            },
            "suggestList": [
                {
                    "id": 9253,
                    "content": "床前明月光啊"
                },
                {
                    "id": 9257,
                    "content": "怎么说英语"
                }
            ]
        },
        {
            "id": 8656,
            "robotId": 102,
            "categoryId": 343,
            "content": "世界和平吗",
            "type": 1,
            "keyword": "和平",
            "suggestType": 3,
            "availableTimeType": null,
            "startTime": null,
            "endTime": null,
            "createTime": "2018-05-30 17:05:53",
            "updateTime": "2018-10-30 18:23:12",
            "suggestList": [
                {
                    "id": 8657,
                    "content": "世界哪里和平了"
                },
                {
                    "id": 9259,
                    "content": "你想去哪儿"
                }
            ]
        }
    ]
}
获取FAQ问题列表(超过1w的数据,使用该接口)
请求地址
- POST /v1/questions/search/scroll
接口说明
- 如果FAQ数量超过1w,请使用此接口。
- 首次请求报文没有scrollId,则返回scrollId和问题列表。后续请求需要带上scrollId,返回scrollId和下一页的问题列表。
请求参数
Request fields
| Path | Type | Optional | Description | 
| pageSize | Integer | true | 每页记录的数量,默认值为20. | 
| robotId | Integer | false | 机器人id. | 
| scrollId | String | false | ES游标ID. | 
| categoryId | Integer | true | 分类id. | 
| searchWord | String | true | 搜索关键词. | 
| searchType | Integer | true | 搜索类型 1:全部问题(问题及相似问法) 2:标准问题(不包含相似问法) 3:答案(默认) 4:全部 | 
| type | Integer | true | 问题类型 1:问题 3:流程 4:闲聊 0:全部(默认) | 
| order | Integer | true | 根据更新时间排序 1:正序(默认)2:倒序. | 
| isWorking | Integer | true | 是否生效 1:全部(默认)2:有效 3:无效. | 
| channelIdList | Array | true | 场景列表. | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码. | 
| message | String | 执行结果说明. | 
| data | Object | 问题列表信息 | 
| data.scrollId | String | ES游标ID. | 
| data.questionList | Array | 问题列表信息 | 
| data.questionList[].id | Integer | 主问题id. | 
| data.questionList[].robotId | Integer | 机器人id. | 
| data.questionList[].categoryId | Integer | 分类id. | 
| data.questionList[].content | String | 问题内容. | 
| data.questionList[].type | Integer | 问题类型. | 
| data.questionList[].keyword | String | 强制召回词. | 
| data.questionList[].suggestType | Integer | 建议类型 1:关闭 2:智能推荐 3:手动推荐. | 
| data.questionList[].availableTimeType | Integer | 生效时间 0:表示永久无效 1:表示永久有效 2:表示自定义有效期. | 
| data.questionList[].startTime | String | 生效时间. | 
| data.questionList[].endTime | String | 失效时间. | 
| data.questionList[].createTime | String | 创建时间. | 
| data.questionList[].updateTime | String | 更新时间. | 
| data.questionList[].answer | Object | 问题答案. | 
| data.questionList[].answer.id | Integer | 问题答案ID. | 
| data.questionList[].answer.content | String | 答案内容. | 
| data.questionList[].answer.type | Integer | 问题答案类型 | 
| data.questionList[].suggestList | Array | 问题答案建议列表. | 
| data.questionList[].suggestList[].id | Integer | 建议ID. | 
| data.questionList[].suggestList[].content | String | 建议内容. | 
示例
$ curl 'https://km.udesk.cn/api/v1/questions/search?email=admin@udesk.cn×tamp=1529402458&sign=29beefc01662bd040a74880346f3da4491a357cf' -i -X POST -H 'Content-Type: application/json' -d '{
  "pageNum" : 1,
  "pageSize" : 10,
  "robotId" : 102,
  "categoryId" : null,
  "searchWord" : "世界",
  "searchType" : 3,
  "type" : 1,
  "order" : 2,
  "isWorking" : 1,
  "channelIdList" : null,
  "scrollId": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAHayFmRMNnQ5eGhnVGp1cTQ2XzRBU0pVcncAAAAAAAB2tBZkTDZ0OXhoZ1RqdXE0Nl80QVNKVXJ3AAAAAAAAdrMWZEw2dDl4aGdUanVxNDZfNEFTSlVydwAAAAAAAHa1FmRMNnQ5eGhnVGp1cTQ2XzRBU0pVcncAAAAAAAB2thZkTDZ0OXhoZ1RqdXE0Nl80QVNKVXJ3"
}'
返回
{
  "code": 200,
  "message": "OK",
  "visible": false,
  "exception": null,
  "paging": {
    "pageNum": 1,
    "pageSize": 10,
    "total": 2
  },
  "data": {
    "scrollId": "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAHayFmRMNnQ5eGhnVGp1cTQ2XzRBU0pVcncAAAAAAAB2tBZkTDZ0OXhoZ1RqdXE0Nl80QVNKVXJ3AAAAAAAAdrMWZEw2dDl4aGdUanVxNDZfNEFTSlVydwAAAAAAAHa1FmRMNnQ5eGhnVGp1cTQ2XzRBU0pVcncAAAAAAAB2thZkTDZ0OXhoZ1RqdXE0Nl80QVNKVXJ3",
    "questionList": [
      {
        "id": 8657,
        "robotId": 102,
        "categoryId": 343,
        "content": "世界哪里和平了",
        "type": 1,
        "keyword": "和平",
        "suggestType": 3,
        "availableTimeType": null,
        "startTime": null,
        "endTime": null,
        "createTime": "2018-05-30 17:06:13",
        "updateTime": "2018-10-31 13:57:47",
        "answer": {
          "id": 4442,
          "content": "<p>没有</p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>\n<p><audio style=\"display: none;\" controls=\"controls\"></audio></p>",
          "type": 2
        },
        "suggestList": [
          {
            "id": 9253,
            "content": "床前明月光啊"
          },
          {
            "id": 9257,
            "content": "怎么说英语"
          }
        ]
      },
      {
        "id": 8656,
        "robotId": 102,
        "categoryId": 343,
        "content": "世界和平吗",
        "type": 1,
        "keyword": "和平",
        "suggestType": 3,
        "availableTimeType": null,
        "startTime": null,
        "endTime": null,
        "createTime": "2018-05-30 17:05:53",
        "updateTime": "2018-10-30 18:23:12",
        "suggestList": [
          {
            "id": 8657,
            "content": "世界哪里和平了"
          },
          {
            "id": 9259,
            "content": "你想去哪儿"
          }
        ]
      }
    ]
  }
}
获取FAQ问题详情
请求地址
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| id | int | false | 问题ID. | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码. | 
| message | String | 执行结果说明. | 
| data | Object | 问题信息 | 
| data.id | Integer | 主问题id. | 
| data.robotId | Integer | 机器人id. | 
| data.categoryId | Integer | 分类id. | 
| data.content | String | 问题内容. | 
| data.type | Integer | 类型 1:普通问题 2:相似问题 3:流程入口问题. 4:闲聊 | 
| data.keyword | String | 强制召回词. | 
| data.suggestType | Integer | 建议类型 1,关闭  2,智能推荐  3,手动推荐. | 
| data.availableTimeType | Integer | 生效时间 0 表示永久无效, 1 表示永久有效, 2 表示自定义有效期. | 
| data.startTime | String | 生效时间. | 
| data.endTime | String | 失效时间. | 
| data.createTime | String | 创建时间. | 
| data.updateTime | String | 更新时间. | 
| data.needLearnCount | Integer | 需要学习数量. | 
| data.answer | Object | 问题答案. | 
| data.answer.id | Integer | 答案ID. | 
| data.answer.content | String | 答案内容. | 
| data.answer.type | Integer | 答案类型 1:纯文本 2:富文本 3:语音 4.链接 5.图片 | 
| data.answer.attachmentList[] | Array | 附件 | 
| data.answer.attachmentList[].name | String | 附件名称 | 
| data.answer.attachmentList[].address | String | 附件地址 | 
| data.answer.attachmentList[].size | Long | 附件大小(字节) | 
| data.suggestList | Array | 问题推荐列表. | 
| data.suggestList[].id | Integer | 推荐问题ID. | 
| data.suggestList[].content | String | 推荐问题内容. | 
| data.suggestList[].type | Integer | 推荐问题类型 1:普通问题 2:相似问题 3:流程入口问题. 4:闲聊 | 
| data.suggestList[].orders | Integer | 推荐问题排序. | 
| data.channelList | Array | 场景列表. | 
| data.channelList[].id | Integer | 场景id. | 
| data.channelList[].robotId | Integer | 机器人Id. | 
| data.channelList[].name | String | 场景名称. | 
| data.channelList[].description | String | 场景描述. | 
| data.channelList[].type | Integer | type 1:默认 2:非默认. | 
示例
$ curl 'https://km.udesk.cn/api/v1/questions/1232?email=admin@udesk.cn×tamp=1529402455&sign=d4be213127c62bb5b53dea5f5e52eaad06b2362f' -i -H 'Accept: application/json'
返回
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": null,
    "data": {
        "id": 1232,
        "robotId": 83,
        "categoryId": 295,
        "content": "还款出现异常情况怎么办?",
        "type": 1,
        "keyword": "",
        "suggestType": 1,
        "availableTimeType": 1,
        "startTime": null,
        "endTime": null,
        "createTime": "2018-02-28 18:32:23",
        "updateTime": "2018-06-13 15:20:04",
        "needLearnCount": null,
        "answer": {
            "id": 727,
            "content": "如果您在还款过程中或还款后出现异常情况,请保留好操作截图,并第一时间联系人工客服寻求帮助哦!",
            "type": 2,
            "attachmentList": [
                {
                    "name": "1.xlsx",
                    "address": "https://staging-udesk.oss-cn-beijing.aliyuncs.com/Data/6/1.xlsx",
                    "size": 18183
                },
                {
                    "name": "2.xlsx",
                    "address": "https://staging-udesk.oss-cn-beijing.aliyuncs.com/Data/6/2.xlsx",
                    "size": 18184
                },
            ]
        },
        "suggestList": null,
        "channelList": [
            {
                "id": 82,
                "robotId": 83,
                "name": "系统默认场景",
                "description": "系统默认场景",
                "type": 1
            }
        ]
    }
}
请求失败原因
{
  "code": 400,
  "message": "{具体的异常信息}",
  "visible": false
}
| message | description | 
| "The problem does not exist or has been deleted!" | 问题不存在或已删除 | 
新建FAQ问题
请求地址
接口说明
- 此接口支持创建FAQ问题,和FAQ寒暄库问题
 暂不支持创建流程
请求参数
Request fields
| Path | Type | Optional | Description | 
| robotId | Integer | false | 机器人ID. | 
| categoryId | Integer | false | 分类ID. | 
| labelIds | Array | false | 知识标签ID. | 
| content | String | false | 问题内容. 不超过200字符 | 
| type | Integer | false | 问题类型 1.普通问题 4.闲聊 | 
| answer | Object | false | 答案 | 
| answer.content | String | true | 答案内容. | 
| answer.type | Integer | true | 文本类型 2.富文本 3.语音 4.链接 5.图片(3,4,5类型均为url地址) | 
| answer.attachmentList[] | Array | true | 附件 | 
| answer.attachmentList[].name | String | true | 附件名称 | 
| answer.attachmentList[].address | String | true | 附件地址 | 
| answer.attachmentList[].size | Long | true | 附件大小(字节) | 
| channelList | Array | false | 场景列表.可以在系统设置->机器人管理->场景管理获取 | 
| channelList[].id | Integer | false | 场景ID. | 
| availableTimeType | Integer | true | 生效时间 0 表示永久无效, 1 表示永久有效, 2 表示自定义有效期. | 
| startTime | String | true | 问题生效开始时间. 如果availableTimeType=3,为必填 | 
| endTime | String | true | 问题生效结束时间. 如果availableTimeType=3,为必填 | 
| keyword | String | true | 关键词:逗号分割. | 
| suggestType | Integer | false | 推荐类型 1:关闭  2:智能推荐  3:手动推荐. | 
| suggestsList | Array | true | 推荐问题列表 | 
| suggestsList[].id | Integer | true | 推荐问题ID. | 
| isSwitchStaff | Integer | true | 推荐转人工是否开启. 0关闭 1开启 | 
请求结果
| Parameter | Type | Description | 
| code | Integer | 执行结果码 | 
| message | String | 执行结果说明 | 
| data | Object | 问题信息 | 
| data.id | Integer | 主问题id. | 
| data.robotId | Integer | 机器人id. | 
| data.categoryId | Integer | 分类id. | 
| data.content | String | 问题内容. | 
| data.type | Integer | 问题类型 1.普通问题 4.闲聊. | 
| data.keyword | String | 问题的强制召回词. | 
| data.availableTimeType | Integer | 问题生效时间 0 表示永久无效, 1 表示永久有效, 2 表示自定义有效期. | 
| data.startTime | String | 问题开始生效时间. | 
| data.endTime | String | 问题结束生效时间. | 
| data.createTime | String | 问题创建时间. | 
| data.updateTime | String | 问题更新时间. | 
| data.answer | Object | 问题答案. | 
| data.answer.id | Integer | 问题答案ID. | 
| data.answer.content | String | 问题答案内容. | 
| data.answer.type | Integer | 问题答案类型 1:出文本 2:富文本 3:语音 4:链接 5:图片 | 
| data.answer.attachmentList[] | Array | 附件 | 
| data.answer.attachmentList[].name | String | 附件名称 | 
| data.answer.attachmentList[].address | String | 附件地址 | 
| data.answer.attachmentList[].size | Long | 附件大小(字节) | 
| data.suggestType | Integer | 问题推荐类型 1:关闭 2:智能推荐 3:手动推荐. | 
| data.suggestList | Array | 问题推荐列表 | 
| data.suggestList[].id | Integer | 推荐问题ID | 
| data.suggestList[].content | String | 推荐问题内容. | 
| data.suggestList[].type | Integer | 推荐问题类型 1:普通问题 3:流程入口问题 | 
| data.channelList | Array | 问题场景列表. | 
| data.channelList[].id | Integer | 问题场景id. | 
| data.channelList[].robotId | Integer | 机器人Id. | 
| data.channelList[].name | String | 场景名. | 
| data.channelList[].description | String | 场景描述. | 
| data.channelList[].type | Integer | 场景类型 1:默认 2:非默认. | 
示例
$ curl 'https://km.udesk.cn/api/v1/questions?email=admin@udesk.cn×tamp=1529402459&sign=814452f1c81d0f43303a30c4a6fd1c894d152ef3' -i -X POST -H 'Content-Type: application/json' -d '{
  "robotId" : 102,
  "categoryId" : 343,
  "labelIds" : [1,2],
  "content" : "身份证怎么办理",
  "type" : 1,
  "mainId" : 0,
  "availableTimeType" : 1,
  "startTime" : null,
  "endTime" : null,
  "keyword" : "身份证,身份证明",
  "suggestType" : 1,
  "suggestsList" : null,
  "isSwitchStaff" : null,
  "flow" : null
}'
返回
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": null,
    "data": {
        "id": 9458,
        "robotId": 102,
        "categoryId": 343,
        "content": "身份证怎么办理",
        "type": 1,
        "keyword": "身份证,身份证明",
        "suggestType": 1,
        "availableTimeType": 1,
        "startTime": null,
        "endTime": null,
        "createTime": "2018-10-31 11:12:39",
        "updateTime": "2018-10-31 11:12:39",
        "answer": {
            "id": 5142,
            "content": "百度一下,你就知道",
            "type": 1
        },
        "suggestList": null,
        "channelList": [
            {
                "id": 105,
                "robotId": 102,
                "name": "系统默认场景",
                "description": "系统默认场景",
                "type": 1
            }
        ]
    }
}
请求失败原因
{
  "code": 400,
  "message": "{具体的异常信息}",
  "visible": false
}
| message | description | 
| 您的知识库已到达上限,如需升级知识库容量,请联系Udesk | 知识库FAQ数量已达上限 | 
| "The robot does not exist or has been deleted!" | 该机器人不存在或已删除 | 
| "Category doesn't belong to the Robot!" | 分类不属于该机器人 | 
| "场景不存在或已经被删除!场景ID:{id}" | 场景不存在或已经被删除!场景ID:{id} | 
| "场景不属于该机器人!场景ID:{id}" | 场景不属于该机器人!场景ID:{id} | 
| 启动生效时间后,时间范围不可为空 | 生效时间不能为空 | 
| 与现有问题重复!问题Id:{id} | 与现有问题重复 | 
| "【answer.content】答案不能为空" | 答案内容不能为空 | 
| "【channelList】org.hibernate.validator.constraints.NotEmpty.message" | 至少选择一个场景 | 
| "Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)" | 相似问法不符合要求(相似问法不能为空字符且长度不能大于200个字符!) | 
| "【...】javax.validation.constraints.NotNull.message" | 【具体字段】不能为空 | 
删除FAQ问题
请求地址
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| id | Integer | false | 问题ID. | 
请求结果
示例
$ curl 'https://km.udesk.cn/api/v1/questions/9362?email=admin@udesk.cn×tamp=1529402460&sign=87e3763301d72ad81aacc823883c3c96a5fcbcfc' -i -X DELETE -H 'Content-Type: application/json'
编辑FAQ问题
请求地址
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| id | Integer | false | 问题ID. | 
Request fields
| Path | Type | Optional | Description | 
| id | Integer | true | 问题ID. | 
| categoryId | Integer | false | 分类ID. | 
| labelIds | Array | false | 知识标签ID. | 
| content | String | false | 问题内容. 不超过200字符 | 
| type | Integer | true | 问题类型. 1:普通问题 4.闲聊 | 
| answerUpdateRequest | Object | false | 问题答案. | 
| answerUpdateRequest.id | Integer | false | 答案ID. | 
| answerUpdateRequest.content | String | false | 答案内容. | 
| answerUpdateRequest.type | Integer | true | 答案类型 2.富文本 3.语音 4.链接 5.图片(3,4,5类型均为url地址) | 
| answerUpdateRequest.attachmentList[] | Array | 附件 |  | 
| answerUpdateRequest.attachmentList[].name | String | 附件名称 |  | 
| answerUpdateRequest.attachmentList[].address | String | 附件地址 |  | 
| answerUpdateRequest.attachmentList[].size | Long | 附件大小(字节) |  | 
| simpleChannelList | Array | false | 场景列表.可以在系统设置->机器人管理->场景管理获取 | 
| simpleChannelList[].id | Integer | false | 场景ID. | 
| availableTimeType | Integer | true | 生效时间 0 表示永久无效, 1 表示永久有效, 2 表示自定义有效期. | 
| startTime | String | true | 问题生效开始时间. 如果availableTimeType=3,为必填 | 
| endTime | String | true | 问题生效结束时间. 如果availableTimeType=3,为必填 | 
| keyword | String | true | 问题关键词. | 
| suggestType | Integer | true | 问题推荐类型 1:关闭 2:智能推荐 3:手动推荐. | 
| suggestsList | Array | true | 推荐问题列表 | 
| suggestsList[].id | Integer | true | 推荐问题ID. | 
| isSwitchStaff | Integer | true | 推荐转人工. | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码 | 
| message | String | 执行结果说明 | 
| data | null | true | 
示例
$ curl 'https://km.udesk.cn/api/v1/questions/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json' -d '{
  "id":9458,
  "categoryId" : 343,
  "labelIds" : [1,2],
  "content" : "身份证怎么办理啊",
  "type": 1,
  "answerUpdateRequest" : {
    "id": 5142,
    "content" : "google一下,你就知道",
    "type" : 1
  },
  "simpleChannelList" : [ {
    "id" : 105
  } ],
  "availableTimeType" : 1,
  "startTime" : null,
  "endTime" : null,
  "suggestType" : 1,
  "suggestsList" : null,
  "isSwitchStaff" : null
}'
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : null
}
请求失败原因
{
  "code": 400,
  "message": "{具体的异常信息}",
  "visible": false
}
| message | description | 
| 您的知识库已到达上限,如需升级知识库容量,请联系Udesk | 知识库FAQ数量已达上限 | 
| "The robot does not exist or has been deleted!" | 该机器人不存在或已删除 | 
| "Category doesn't belong to the Robot!" | 分类不属于该机器人 | 
| "场景不存在或已经被删除!场景ID:{id}" | 场景不存在或已经被删除!场景ID:{id} | 
| "场景不属于该机器人!场景ID:{id}" | 场景不属于该机器人!场景ID:{id} | 
| 启动生效时间后,时间范围不可为空 | 生效时间不能为空 | 
| 与现有问题重复!问题Id:{id} | 与现有问题重复 | 
| "【answer.content】答案不能为空" | 答案内容不能为空 | 
| "【channelList】org.hibernate.validator.constraints.NotEmpty.message" | 至少选择一个场景 | 
| "Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)" | 相似问法不符合要求(相似问法不能为空字符且长度不能大于200个字符!) | 
| "【...】javax.validation.constraints.NotNull.message" | 【具体字段】不能为空 | 
分页获取相似问接口列表
请求地址
- GET /v1/faq/similar/{questionId}
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| questionId | Integer | false | 主问题ID. | 
| pageNum | Integer | true | 页码默认1 | 
| pageSize | Integer | true | 每页条数默认10 | 
Request fields
| Path | Type | Optional | Description | 
|  |  |  |  | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码 | 
| message | String | 执行结果说明 | 
| data | Array | 返回数据 | 
| data[].id | Integer | 相似问Id | 
| data[].content | String | 相似问内容 | 
| paging | Object | 分页信息 | 
| paging.pageNum | Integer | 页码 | 
| paging.pageSize | Integer | 每页条数 | 
| paging.total | Long | 分页信息 | 
示例
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X GET -H 'Content-Type: application/json'
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : [{
       "id": 78234,
       "content": "相似问示例1"
   },{
        "id": 78235,
       "content": "相似问示例2"
   }],
   "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 773
   }
}
新增相似问接口列表
请求地址
- POST /v1/faq/similar/{questionId}
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| questionId | Integer | false | 主问题ID. | 
Request fields
| Path | Type | Optional | Description | 
| content | String | false | 问题内容. | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码 | 
| message | String | 执行结果说明 | 
| data | Object | 返回数据 | 
| data.id | Integer | 相似问Id | 
| data.content | String | 相似问内容 | 
示例
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X POST -H 'Content-Type: application/json'
-d'{
  "content" : "相似问示例1"
}'
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
       "id": 78234,
       "content": "相似问示例1"
   }
}
编辑相似问接口列表
请求地址
- PUT /v1/faq/similar/{questionId}
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| questionId | Integer | false | 主问题ID. | 
Request fields
| Path | Type | Optional | Description | 
| id | Integer | false | 相似问Id. | 
| content | String | false | 相似问内容. | 
| ### 请求结果 |  |  |  | 
| Path | Type | Description |  | 
| --- | --- | --- |  | 
| code | Integer | 执行结果码 |  | 
| message | String | 执行结果说明 |  | 
| data | Object | 返回数据 |  | 
| data.id | Integer | 相似问Id |  | 
| data.content | String | 相似问内容 |  | 
示例
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json'
-d'{
  "id": "78234",
  "content" : "相似问示例1"
}'
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
       "id": 78234,
       "content": "相似问示例1"
   }
}
删除相似问接口列表
请求地址
- DELETE /v1/faq/similar/{questionId}
请求参数
Path parameters
| Parameter | Type | Optional | Description | 
| questionId | Integer | false | 主问题ID. | 
Request parameters
| Parameter | Type | Optional | Description | 
| similar | Integer | false | 相似问问题ID. | 
Request fields
| Path | Type | Optional | Description | 
|  |  |  |  | 
请求结果
| Path | Type | Description | 
| code | Integer | 执行结果码 | 
| message | String | 执行结果说明 | 
| data | null | 无 | 
示例
$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?similarId=78234&email=admin@udesk.cn×tamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X DELETE -H 'Content-Type: application/json'
返回
{
  "code" : 200,
  "message" : "OK",
  "visible" : false
}