Getting the Knowledge Base Question List
This interface is used to get the list of knowledge base questions under a certain customer service, or under a specified category.
Request Method
GET /knowledge_questions
Request Parameters (Query String)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
catalog_id | Integer | Yes | Knowledge base category id | |
agent_id | Integer | Yes | The id of the owner of the knowledge base category | |
page | Integer | No | Page number, starting from 1, default is 1 | |
per_page | Integer | No | Number of items per page, default is 20, maximum is 100 |
Notes:
- catalog_id: The specific category id or 0 or -1, 0 represents all, -1 represents uncategorized.
- agent_id: The specific customer service id or 0, 0 represents the administrator.
Return Data
Attribute Name | Type | Description |
---|---|---|
code | Integer | Execution result code, 1000 represents success |
knowledge_questions | Array | Knowledge base question list |
meta | Object | Pagination related content, see Common Data |
knowledge_questions data structure
Attribute Name | Type | Description |
---|---|---|
id | Integer | Knowledge base question id |
title | String | Knowledge base question name |
content | String | Knowledge base question answer |
content_type | String | Knowledge base question answer type |
catalog_id | Integer | Knowledge base category id |
updated_at | Date Time | Last update time of the knowledge base question |
lasts | Boolean | Whether the knowledge base question is permanently valid |
last_min | Date Time | Lower limit of the validity period of the knowledge base question |
last_max | Date Time | Upper limit of the validity period of the knowledge base question |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_questions?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2&catalog_id=0&agent_id=0
Response
{
"code": 1000,
"knowledge_questions": [
{
"id": 1,
"title": "Question 1",
"content": "AAAAAAA",
"content_type": "text",
"lasts": true,
"catalog_id": null,
"updated_at": "2018-03-22T11:29:59.000+08:00",
"last_min": null,
"last_max": null
},
{
"id": 3,
"title": "Water Water",
"content": "Water Water",
"content_type": "text",
"lasts": true,
"catalog_id": 17,
"updated_at": "2018-03-22T18:35:02.000+08:00",
"last_min": "2018-03-31",
"last_max": "2018-04-03"
}
],
"meta": {
"current_page": 1,
"total_pages": 1,
"total_count": 2
}
}
Updating the Knowledge Base
This interface is used to modify a specific knowledge base question.
Request Method
PUT /knowledge_questions/:id
Request Parameters (URL)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
id | Integer | Yes | Knowledge base question id |
Request Parameters (Request Body)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
question | Object | Yes | The specific value of the question |
question data structure
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
agent_id | Integer | Yes | The id of the creator of the question | |
content | String | No | The answer of the question | |
title | String | No | The name of the question | |
content_type | String | No | The type of the question answer | |
lasts | Boolean | Yes | Whether the knowledge base question is permanently valid | |
last_min | Date Time | No | Lower limit of the validity period of the knowledge base question | |
last_max | Date Time | No | Upper limit of the validity period of the knowledge base question |
Notes:
- The value of agent_id is the specific customer service id or 0, 0 represents the administrator.
- If the value of content/title/content_type is "" or null, it is considered not to be modified.
- The value of content_type is text/html.
- When the value of lasts is true, the values of last_min and last_max are not saved.
Return Data
Attribute Name | Type | Description |
---|---|---|
code | Integer | Execution result code, 1000 represents success |
id | Integer | Knowledge base id |
title | String | Knowledge base question name |
content_type | String | Knowledge base question content type |
content | String | Knowledge base content |
lasts | Boolean | Whether the knowledge base question is permanently valid |
last_min | Date Time | Lower limit of the validity period of the knowledge base question |
last_max | Date Time | Upper limit of the validity period of the knowledge base question |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_questions/8?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X PUT \
-H 'content-type: application/json' \
-d '
{
"question": {
"agent_id": 0,
"content": "asasasaasasadasass",
"title": "",
"content_type": "",
"lasts": false,
"last_min": "2018-03-31",
"last_max": "2018-04-03"
}
}
'
Response
{
"code": 1000,
"id": 8,
"title": "title5",
"content": "asasasaasasadasass",
"content_type": "html",
"catalog_id": null,
"lasts": false,
"last_min": "2018-03-31",
"last_max": "2018-04-03"
}
Adding to the Knowledge Base
This interface is used to create a new knowledge base question under a certain customer service's specific knowledge base category.
Request Method
POST /knowledge_questions
Request Parameters (Request Body)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
question | Object | Yes | The specific value of the question |
question data structure
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
agent_id | Integer | Yes | The id of the creator of the question | |
content | String | Yes | The answer of the question | |
title | String | Yes | The name of the question | |
content_type | String | Yes | The type of the question answer | |
catalog_id | Integer | Yes | Knowledge base category id | |
lasts | Boolean | Yes | Whether the knowledge base question is permanently valid | |
last_min | Date Time | No | Lower limit of the validity period of the knowledge base question | |
last_max | Date Time | No | Upper limit of the validity period of the knowledge base question |
Notes:
- catalog_id: The specific category id or 0 or -1, 0 represents all, -1 represents uncategorized.
- agent_id: The specific customer service id or 0, 0 represents the administrator.
Return Data
Attribute Name | Type | Description |
---|---|---|
code | Integer | Execution result code, 1000 represents success |
id | Integer | Knowledge base id |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_questions?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05ee1594&sign_version=v2 \
-X POST \
-H 'content-type: application/json' \
-d '
{
"question": {
"agent_id": 0,
"content": "asasasas",
"title": "title1",
"content_type": "html",
"catalog_id":0,
"lasts": true
}
}
'
Response
{
"code": 1000,
"id": 8,
"title": "title5",
"content": "asasasas",
"content_type": "html",
"catalog_id": null,
"lasts": true,
"last_min": null,
"last_max": null
}
Deleting from the Knowledge Base
This interface is used to delete a specific knowledge base question.
Request Method
DELETE /knowledge_questions/:id
Request Parameters (URL)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
id | Integer | Yes | Knowledge base question id |
Request Parameters (Request Body)
Parameter Name | Type | Required | Description | Constraints |
---|---|---|---|---|
agent_id | Integer | Yes | The id of the creator of the question |
Return Data
Attribute Name | Type | Description |
---|---|---|
code | Integer | Execution result code, 1000 represents success |
id | Integer | Knowledge base id |
message | String | Success message |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_questions/8?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X DELETE \
-H 'content-type: application/json' \
-d '
{
"agent_id": 0
}
'
Response
{
"code": 1000,
"id": "8",
"message": "Question deleted successfully"
}