logo

Get FAQ Category List

Request URL

  • GET /v1/categories

Request Parameters

Query Parameters

ParameterTypeOptionalDescription
robotIdIntegerfalseRobot ID

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataArrayCategory information
data[].idIntegerCategory ID
data[].nameStringCategory name
data[].parentIdIntegerParent ID of the category
data[].parentIdsStringParent ID path of the category, separated by commas
data[].robotIdIntegerRobot ID
data[].typeInteger1: System category (All, Unclassified) 2: User-defined category
data[].classifyInteger1: FAQ category

Example

$ curl 'https://km.udesk.cn/api/v1/categories?email=admin@udesk.cn&timestamp=1529402433&sign=e4f683120c26df279b3642ac77b0bd8bf621584a&robotId=102' -i -H 'Accept: application/json'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : [ {
    "id" : 406,
    "name" : "category 2",
    "parentId" : 342,
    "parentIds" : "0,342,",
    "robotId" : 102
  }, {
    "id" : 342,
    "name" : "all",
    "parentId" : 0,
    "parentIds" : "0,",
    "robotId" : 102
  }, {
    "id" : 343,
    "name" : "Uncategorized",
    "parentId" : 342,
    "parentIds" : "0,342,",
    "robotId" : 102
  } ]
}

Get FAQ Category Details

Request URL

  • GET /v1/categories/:id

Request Parameters

Path parameters

ParameterTypeOptionalDescription
idIntegerfalseCategory ID

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataObjectKnowledge base information
data.idIntegerCategory ID
data.nameStringCategory name
data.parentIdIntegerParent ID of the category
data.parentIdsStringParent ID path of the category, separated by commas
data.robotIdIntegerRobot ID
data.typeInteger1: System category (All, Unclassified) 2: User-defined category
data.classifyInteger1: FAQ category

Example

$ curl 'https://km.udesk.cn/api/v1/categories/403?email=admin@udesk.cn&timestamp=1529402429&sign=c8b3e4dfef80a80e6125d2863912f6cdf1d20509' -i -H 'Accept: application/json'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
    "id" : 403,
    "name" : "category 2",
    "parentId" : 342,
    "parentIds" : "0,342,",
    "robotId" : 102, 
    "type": 2,
    "classify": 1
  }
}

Failure Reasons

MessageDescription
"Required int parameter 'robotId' is not present"The value of robotId in the parameters cannot be empty

Delete FAQ Category

Request URL

  • DELETE /v1/categories/:id

Request Parameters

Path parameters

ParameterTypeOptionalDescription
idIntegerfalseCategory ID

Response

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

Example

$ curl 'https://km.udesk.cn/api/v1/categories/379?email=admin@udesk.cn&timestamp=1529402432&sign=67df1ddd1aad415933d63da93ca24b59c8970740' -i -X DELETE -H 'Content-Type: application/json'

Create New FAQ Category

Request URL

  • POST /v1/categories

Request Parameters

Request Fields

ParameterTypeOptionalDescription
nameStringfalseCategory name
parentIdIntegerfalseParent category ID
robotIdIntegerfalseRobot ID
classifyIntegertrue1. Knowledge base category 2. Greeting library category

Response

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataObjectCategory information
data.idIntegerCategory ID
data.nameStringCategory name
data.parentIdIntegerParent ID of the category
data.parentIdsStringParent ID path of the category, separated by commas
data.robotIdIntegerRobot ID
data.typeInteger1: System category (All, Unclassified) 2: User-defined

category | | data.classify | Integer| 1: FAQ category |

Example

$ curl 'https://km.udesk.cn/api/v1/categories?email=admin@udesk.cn&timestamp=1529402431&sign=bd23cf273d088d9c9031958712670673dae1d5ce' -i -X POST -H 'Content-Type: application/json' -d '{
  "name" : "category 2",
  "parentId" : 342,
  "robotId" : 102,
  "classify": 1
}'
Response
{
  "code" : 200,
  "message" : "OK",
  "visible" : false,
  "data" : {
    "id" : 404,
    "name" : "category 2",
    "parentId" : 342,
    "parentIds" : "0,342,",
    "robotId" : 102,
    "num": null, #num indicates the number of FAQs under the current category
    "type": 2,
    "classify": 1
  }
}

Failure Reasons

MessageDescription
"Duplicates name with existing directories"Duplicate category name or abnormal value of integer parameters
"【name】org.hibernate.validator.constraints.NotBlank.message"The name parameter cannot be empty
"【parentId】javax.validation.constraints.NotNull.message"The parentId parameter cannot be empty
"【robotId】javax.validation.constraints.NotNull.message"The robotId parameter cannot be empty