logo

Retrieve a List of Common Question Templates

Request Address

  • GET /v1/robots/:id/commonQuestionModels

Request Parameters

Path Parameters

ParameterTypeOptionalDescription
idIntegerfalseRobot ID.

Query Parameters

ParameterTypeOptionalDescription
pageNumIntegertruePage number, default is 1.
pageSizeIntegertrueNumber of records per page, default is 20.
searchTypeIntegertrue1. Search by the name field 2. Search by the modelKey field.
searchWordStringtrueSearch keyword.

Request Result

PathTypeDescription
codeIntegerExecution result code.
messageStringExecution result description.
dataArrayTemplate list information.
data[].idIntegerTemplate ID.
data[].robotIdIntegerRobot ID.
data[].nameStringTemplate name.
data[].descriptionStringTemplate description.
data[].modelKeyStringTemplate identification key modelKey (can be passed during session initialization).

Example

$ curl 'https://km.udesk.cn/api/v1/robots/83/commonQuestionModels?email=admin@udesk.cn&timestamp=1540881364&sign=4708c26e84801bf4508a44cfbc110c02dceab794' -i
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : [ {
    "id" : 88,
    "robotId" : 83,
    "name" : "Default Recommendation 1",
    "description" : "Default recommendation",
    "modelKey" : "0"
  }, {
    "id" : 69,
    "robotId" : 83,
    "name" : "king",
    "description" : "Guidance into...",
    "modelKey" : "hey hey hey"
  }, {
    "id" : 118,
    "robotId" : 83,
    "name" : "Test",
    "description" : "dd",
    "modelKey" : "dc"
  } ]
}

Request Failure Reasons

MessageDescription
"Failed to convert value of type 'java.lang.String' to required type 'int'Exception in integer parameter value

Retrieve FAQ Question List

Request Address

  • POST /v1/questions/search

Request Parameters

Request Fields

PathTypeOptionalDescription
pageNumIntegertruePage number, default is 1.
pageSizeIntegertrueNumber of records per page, default is 20.
robotIdIntegerfalseRobot ID.
categoryIdIntegertrueCategory ID.
searchWordStringtrueSearch keyword.
searchTypeIntegertrueSearch type 1: All questions (questions and similar phrases) 2: Standard questions (excluding similar phrases) 3: Answer (default) 4: All
typeIntegertrueQuestion type 1: Question 3: Process 4: Chat 0: All (default)
orderIntegertrueSort by update time 1: Ascending (default) 2: Descending.
isWorkingIntegertrueWhether effective 1: All (default) 2: Valid 3: Invalid.
channelIdListArraytrueScene list.

Request Result

PathTypeDescription
codeIntegerExecution result code.
messageStringExecution result description.
dataArrayQuestion list information
data[].idIntegerMain question ID.
data[].robotIdIntegerRobot ID.
data[].categoryIdIntegerCategory ID.
data[].contentStringQuestion content.
data[].typeIntegerQuestion type.
data[].keywordStringForced recall word.
data[].suggestTypeIntegerSuggestion type 1: Close 2: Intelligent recommendation 3: Manual recommendation.
data[].availableTimeTypeIntegerEffective time 0: Permanently invalid 1: Permanently valid 2: Custom validity period.
data[].startTimeStringEffective time.
data[].endTimeStringExpiration time.
data[].createTimeStringCreation time.
data[].updateTimeStringUpdate time.
data[].answerObjectQuestion answer.
data[].answer.idIntegerAnswer ID.
data[].answer.contentStringAnswer content.
data[].answer.typeIntegerQuestion answer type
data[].suggestListArrayQuestion answer suggestion list.
data[].suggestList[].idIntegerSuggestion ID.
data[].suggestList[].contentStringSuggestion content.

Example

$ curl 'https://km.udesk.cn/api/v1/questions/search?email=admin@udesk.cn&timestamp=1529402458&sign=29beefc01662bd040a74880346f3da4491a357cf' -i -X POST -H 'Content-Type: application/json' -d '{
  "pageNum" : 1,
  "pageSize" : 10,
  "robotId" : 102,
  "categoryId" : null,
  "searchWord" : "world",
  "searchType" : 3,
  "type" : 1,
  "order" : 2,
  "isWorking" : 1,
  "channelIdList" : null
}'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 2
    },
    "data": [
        {
            "id": 8657,
            "robotId": 102,
            "categoryId": 343,
            "content": "Where is peace in the world",
            "type": 1,
            "keyword": "peace",
            "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>No</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": "The moonlight in front of the bed"
                },
                {
                    "id": 9257,
                    "content": "How to speak English"
                }
            ]
        },
        {
            "id": 8656,
            "robotId": 102,
            "categoryId": 343,
            "content": "Is the world at peace",
           

 "type": 1,
            "keyword": "peace",
            "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": "Where is peace in the world"
                },
                {
                    "id": 9259,
                    "content": "Where do you want to go"
                }
            ]
        }
    ]
}

Retrieve FAQ Question Details

Request Address

  • GET /v1/questions/:id

Request Parameters

Path Parameters

ParameterTypeOptionalDescription
idintfalseQuestion ID.

Request Result

PathTypeDescription
codeIntegerExecution result code.
messageStringExecution result description.
dataObjectQuestion information.
data.idIntegerMain question ID.
data.robotIdIntegerRobot ID.
data.categoryIdIntegerCategory ID.
data.contentStringQuestion content.
data.typeIntegerType 1: Regular question 2: Similar question 3: Process entry question 4: Chat.
data.keywordStringForced recall word for the question.
data.suggestTypeIntegerSuggestion type 1: Close 2: Smart recommendation 3: Manual recommendation.
data.availableTimeTypeIntegerEffective time 0: Permanently invalid 1: Permanently valid 2: Custom validity period.
data.startTimeStringEffective time start.
data.endTimeStringEffective time end.
data.createTimeStringCreation time.
data.updateTimeStringUpdate time.
data.needLearnCountIntegerNumber of learning needed.
data.answerObjectQuestion answer.
data.answer.idIntegerAnswer ID.
data.answer.contentStringAnswer content.
data.answer.typeIntegerAnswer type 1: Plain text 2: Rich text 3: Voice 4. Link 5. Image
data.answer.attachmentList[]ArrayAttachments.
data.answer.attachmentList[].nameStringAttachment name.
data.answer.attachmentList[].addressStringAttachment address.
data.answer.attachmentList[].sizeLongAttachment size (in bytes).
data.suggestListArrayQuestion recommendation list.
data.suggestList[].idIntegerRecommended question ID.
data.suggestList[].contentStringRecommended question content.
data.suggestList[].typeIntegerRecommended question type 1: Regular question 2: Similar question 3: Process entry question 4: Chat.
data.suggestList[].ordersIntegerRecommended question order.
data.channelListArrayScene list.
data.channelList[].idIntegerScene ID.
data.channelList[].robotIdIntegerRobot ID.
data.channelList[].nameStringScene name.
data.channelList[].descriptionStringScene description.
data.channelList[].typeIntegerType 1: Default 2: Non-default.

Example

$ curl 'https://km.udesk.cn/api/v1/questions/1232?email=admin@udesk.cn&timestamp=1529402455&sign=d4be213127c62bb5b53dea5f5e52eaad06b2362f' -i -H 'Accept: application/json'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": null,
    "data": {
        "id": 1232,
        "robotId": 83,
        "categoryId": 295,
        "content": "What should I do if there is an abnormality in repayment?",
        "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": "If you encounter an abnormality during or after the repayment process, please keep the operation screenshots and contact customer service for help as soon as possible!",
            "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": "System Default Scene",
                "description": "System Default Scene",
                "type": 1
            }
        ]
    }
}

Request Failure Reasons

{
  "code": 400,
  "message": "{Specific error message}",
  "visible": false
}
messagedescription
"The problem does not exist or has been deleted!"The problem does not exist or has been deleted

Create a New FAQ Question

Request Address

  • POST /v1/questions

Interface Description

  • This interface supports creating FAQ questions and greetings in the FAQ library
    Flow creation is not supported at present

Request Parameters

Request Fields

PathTypeOptionalDescription
robotIdIntegerfalseRobot ID.
categoryIdIntegerfalseCategory ID.
contentStringfalseQuestion content. Not exceeding 200 characters.
typeIntegerfalseQuestion type 1. Regular question 4. Chat
answerObjectfalseAnswer
answer.contentStringtrueAnswer content.
answer.typeIntegertrueText type 2. Rich text 3. Voice 4. Link 5. Image (types 3, 4, and 5 are URL addresses)
answer.attachmentList[]ArraytrueAttachments
answer.attachmentList[].nameStringtrueAttachment name
answer.attachmentList[].addressStringtrueAttachment address
answer.attachmentList[].sizeLongtrueAttachment size (in bytes)
channelListArrayfalseScene list. Can be obtained in system settings -> robot management -> scene management
channelList[].idIntegerfalseScene ID.
availableTimeTypeIntegertrueEffective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period.
startTimeStringtrueEffective start time of the question. Required if availableTimeType=3
endTimeStringtrueEffective end time of the question. Required if availableTimeType=3
keywordStringtrueKeywords: comma-separated.
suggestTypeIntegerfalseRecommendation type 1: Close 2: Smart recommendation 3: Manual recommendation.
suggestsListArraytrueRecommended question list
suggestsList[].idIntegertrueRecommended question ID.
isSwitchStaffIntegertrueWhether to enable recommendation to switch to human staff. 0: Off 1: On

Request Result

ParameterTypeDescription
codeIntegerExecution result code
messageStringExecution result description
dataObjectQuestion information
data.idIntegerMain question ID.
data.robotIdIntegerRobot ID.
data.categoryIdIntegerCategory ID.
data.contentStringQuestion content.
data.typeIntegerQuestion type 1. Regular question 4. Chat.
data.keywordStringForced recall word for the question.
data.availableTimeTypeIntegerQuestion effective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period.
data.startTimeStringQuestion start effective time.
data.endTimeStringQuestion end effective time.
data.createTimeStringQuestion creation time.
data.updateTimeStringQuestion update time.
data.answerObjectQuestion answer.
data.answer.idIntegerQuestion answer ID.
data.answer.contentStringQuestion answer content.
data.answer.typeIntegerQuestion answer type 1: Plain text 2: Rich text 3: Voice 4: Link 5: Image
data.answer.attachmentList[]ArrayAttachments
data.answer.attachmentList[].nameStringAttachment name
data.answer.attachmentList[].addressStringAttachment address
data.answer.attachmentList[].sizeLongAttachment size (in bytes)
data.suggestTypeIntegerQuestion recommendation type 1: Close 2: Smart recommendation 3: Manual recommendation.
data.suggestListArrayQuestion recommendation list
data.suggestList[].idIntegerRecommended question ID
data.suggestList[].contentStringRecommended question content.
data.suggestList[].typeIntegerRecommended question type 1: Regular question 3: Process entry question
data.channelListArrayQuestion scene list.
data.channelList[].idIntegerQuestion scene id.
data.channelList[].robotIdIntegerRobot Id.
data.channelList[].nameStringScene name.
data.channelList[].descriptionStringScene description.
data.channelList[].typeIntegerScene type 1: Default 2: Non-default.

Example

$ curl 'https://km.udesk.cn/api/v1/questions?email=admin@udesk.cn&timestamp=1529402459&sign=814452f1c81d0f43303a30c4a6fd1c894d152ef3' -i -X POST -H 'Content-Type: application/json' -d '{
  "robotId" : 102,
  "categoryId" : 343,
  "content" : "How to apply for an ID card",
  "type" : 1,
  "mainId" : 0,
  "availableTimeType" : 1,
  "startTime" : null,
  "endTime" : null,
  "keyword" : "ID card, identification",
  "suggestType" : 1,
  "suggestsList" : null,
  "isSwitchStaff" : null,
  "flow" : null
}'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception": null,
    "paging": null,
    "data": {
        "id": 9458,
        "robotId": 102,
        "categoryId": 343,
        "content": "How to apply for an ID card",
        "type": 1,
        "keyword": "ID card, identification",
        "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": "Search it on Baidu, you'll know.",
            "type": 1
        },
        "suggestList": null,
        "channelList": [
            {
                "id": 105,
                "robotId": 102,
                "name": "System Default Scene",
                "description": "System Default Scene",
                "type": 1
            }
        ]
    }
}

Request Failure Reasons

{
  "code": 400,
  "message": "{Specific error message}",
  "visible": false
}
messagedescription
Your knowledge base has reached its limit. To upgrade the knowledge base capacity, please contact UdeskThe FAQ quantity of the knowledge base has reached its limit
"The robot does not exist or has been deleted!"The robot does not exist or has been deleted
"Category doesn't belong to the Robot!"Category does not belong to the robot
"Scene does not exist or has been deleted! Scene ID:{id}"The scene does not exist or has been deleted! Scene ID:{id}
"The scene does not belong to the robot! Scene ID:{id}"The scene does not belong to the robot! Scene ID:{id}
Start time of effective time cannot be emptyEffective time cannot be empty
Duplicate with existing problems! Problem Id:{id}Duplicate with existing problems
"【answer.content】Answer cannot be empty"Answer cannot be empty
"【channelList】org.hibernate.validator.constraints.NotEmpty.message"Select at least one scene
"Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)"Similar questions do not meet the requirements (similar questions cannot be null characters and the length cannot be greater than 200 characters!)
"【...】javax.validation.constraints.NotNull.message"【Specific field】cannot be empty

Delete FAQ Question

Request Address

  • DELETE /v1/questions/:id

Request Parameters

Path Parameters

ParameterTypeOptionalDescription
idIntegerfalseQuestion ID.

Request Result

  • None, when the deletion is successful, the HTTP response code is 204.

Example

$ curl 'https://km.udesk.cn/api/v1/questions/9362?email=admin@udesk.cn&timestamp=1529402460&sign=87e3763301d72ad81aacc823883c3c96a5fcbcfc' -i -X DELETE -H 'Content-Type: application/json'

Edit FAQ Question

Request Address

  • PUT /v1/questions/:id

Request Parameters

Path Parameters

ParameterTypeOptionalDescription
idIntegerfalseQuestion ID.

Request Fields

PathTypeOptionalDescription
idIntegertrueQuestion ID.
categoryIdIntegerfalseCategory ID.
contentStringfalseQuestion content. Not exceeding 200 characters.
typeIntegertrueQuestion type. 1: Regular question 4: Chat
answerUpdateRequestObjectfalseQuestion answer.
answerUpdateRequest.idIntegerfalseAnswer ID.
answerUpdateRequest.contentStringfalseAnswer content.
answerUpdateRequest.typeIntegertrueAnswer type 2: Rich text 3: Voice 4: Link 5: Image (types 3, 4, and 5 are URL addresses)
answerUpdateRequest.attachmentList[]ArrayAttachments
answerUpdateRequest.attachmentList[].nameStringAttachment name
answerUpdateRequest.attachmentList[].addressStringAttachment address
answerUpdateRequest.attachmentList[].sizeLongAttachment size (in bytes)
simpleChannelListArrayfalseScene list. Can be obtained in system settings -> robot management -> scene management
simpleChannelList[].idIntegerfalseScene ID.
availableTimeTypeIntegertrueEffective time 0 represents permanently invalid, 1 represents permanently valid, 2 represents custom validity period.
startTimeStringtrueEffective start time of the question. Required if availableTimeType=3
endTimeStringtrueEffective end time of the question. Required if availableTimeType=3
keywordStringtrueQuestion keywords.
suggestTypeIntegertrueQuestion recommendation type 1: Close 2: Smart recommendation 3: Manual recommendation.
suggestsListArraytrueRecommended question list
suggestsList[].idIntegertrueRecommended question ID.
isSwitchStaffIntegertrueRecommendation to switch to human staff.

Request Result

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
datanulltrue

Example

$ curl 'https://km.udesk.cn/api/v1/questions/9458?email=admin@udesk.cn&timestamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json' -d '{
  "id":9458,
  "categoryId" : 343,
  "content" : "How to apply for an ID card",
  "type": 1,
  "answerUpdateRequest" : {
    "id": 5142,
    "content" : "Search it on Google, you'll know.",
    "type" : 1
  },
  "simpleChannelList" : [ {
    "id" : 105
  } ],
  "availableTimeType" : 1,
  "startTime" : null,
  "endTime" : null,
  "suggestType" : 1,
  "suggestsList" : null,
  "isSwitchStaff" : null
}'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : null
}

Request Failure Reasons

{
  "code": 400,
  "message": "{Specific error message}",
  "visible": false
}
messagedescription
Your knowledge base has reached its limit. To upgrade the knowledge base capacity, please contact UdeskThe FAQ quantity of the knowledge base has reached its limit
"The robot does not exist or has been deleted!"The robot does not exist or has been deleted
"Category doesn't belong to the Robot!"Category does not belong to the robot
"Scene does not exist or has been deleted! Scene ID:{id}"The scene does not exist or has been deleted! Scene ID:{id}
"The scene does not belong to the robot! Scene ID:{id}"The scene does not belong to the robot! Scene ID:{id}
Start time of effective time cannot be emptyEffective time cannot be empty
Duplicate with existing problems! Problem Id:{id}Duplicate with existing problems
"【answer.content】Answer cannot be empty"Answer cannot be empty
"【channelList】org.hibernate.validator.constraints.NotEmpty.message"Select at least one scene
"Similar questions do not meet the requirements (similar questions can not be null characters and the length can not be greater than 200 characters!)"Similar questions do not meet the requirements (similar questions cannot be null characters and the length cannot be greater than 200 characters!)
"【...】javax.validation.constraints.NotNull.message"【Specific field】cannot be empty

Pagination API for Retrieving Similar Questions

Request URL

  • GET /v1/faq/similar/{questionId}

Request Parameters

Path parameters

ParameterTypeOptionalDescription
questionIdIntegerfalseMain question ID.
pageNumIntegertrueDefault is 1
pageSizeIntegertrueDefault is 10 per page

Request fields

PathTypeOptionalDescription

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
dataArrayReturned data
data[].idIntegerSimilar question ID
data[].contentStringSimilar question content
pagingObjectPagination information
paging.pageNumIntegerPage number
paging.pageSizeIntegerItems per page
paging.totalLongTotal items count

Example

$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn&timestamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X GET -H 'Content-Type: application/json'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : [{
       "id": 78234,
       "content": "Example of a similar question 1"
   },{
        "id": 78235,
       "content": "Example of a similar question 2"
   }],
   "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 773
   }
}

API for Adding Similar Questions

Request URL

  • POST /v1/faq/similar/{questionId}

Request Parameters

Path parameters

ParameterTypeOptionalDescription
questionIdIntegerfalseMain question ID.

Request fields

PathTypeOptionalDescription
contentStringfalseQuestion content.

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
dataObjectReturned data
data.idIntegerSimilar question ID
data.contentStringSimilar question content

Example

$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn&timestamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X POST -H 'Content-Type: application/json'
-d'{
  "content" : "Example of a similar question 1"
}'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
       "id": 78234,
       "content": "Example of a similar question 1"
   }
}

Editing Similar Question API List

Request URL

  • PUT /v1/faq/similar/{questionId}

Request Parameters

Path parameters

ParameterTypeOptionalDescription
questionIdIntegerfalseMain question ID.

Request fields

PathTypeOptionalDescription
idIntegerfalseSimilar question ID.
contentStringfalseSimilar question content.

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
dataObjectReturned data
data.idIntegerSimilar question ID
data.contentStringSimilar question content

Example

$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?email=admin@udesk.cn&timestamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X PUT -H 'Content-Type: application/json'
-d'{
  "id": "78234",
  "content" : "Example of a similar question 1"
}'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
       "id": 78234,
       "content": "Example of a similar question 1"
   }
}

Deleting Similar Question API List

Request URL

  • DELETE /v1/faq/similar/{questionId}

Request Parameters

Path parameters

ParameterTypeOptionalDescription
questionIdIntegerfalseMain question ID.

Request parameters

ParameterTypeOptionalDescription
similarIntegerfalseSimilar question ID.

Request fields

PathTypeOptionalDescription

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result description
datanullNone

Example

$ curl 'https://km.udesk.cn/api/v1/faq/similar/9458?similarId=78234&email=admin@udesk.cn&timestamp=1529402462&sign=62a0c09fad0446c6bc24fa1ec876ee2eb789297a' -i -X DELETE -H 'Content-Type: application/json'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false
}