knowledge_type Values
| English Name |
|---|
| question |
| useful_expression |
| useful_link |
| attachment |
Creating Different Knowledge Base Categories
This interface is used to create categories for different types of knowledge bases.
Request Method
POST /knowledge_catalogs
Request Parameters (Request Body)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| knowledge_catalog | Object | Yes | Knowledge base parameters | None |
The structure of knowledge_catalog is as follows: | ||||
| Parameter Name | Type | Required | Description | Limitations |
| ----------------------- | -------- | ---------- | ----------------- | ----------------------- |
| name | String | Yes | Name of the knowledge base | No more than 255 characters |
| knowledge_type_name | String | Yes | English name from knowledge_type | None |
| parent_id | Integer | No | ID of the parent category | None |
| agent_id | Integer | Yes | Agent ID | None |
Notes:
knowledge_type_name: Only the four values ofknowledge_typeare supported.agent_id: The value is either the agent ID or 0, where 0 represents the administrator. The owner of the newly created category is the agent corresponding to theagent_id. Other ordinary agents do not have permission to operate this category. If the value ofagent_idis 0, the owner of the new category is the administrator.parent_id: The default value is 0, indicating a top-level category.
Response Data
| Attribute Name | Type | Description |
|---|---|---|
| code | Integer | Execution result code, 1000 represents success |
| name | String | Name of the new category |
| id | Integer | ID of the new category |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X POST \
-H 'content-type: appliacation/json' \
-d '
{
"knowledge_catalog": {
"knowledge_type_name": "question",
"name": "Question library1",
"agent_id":0,
"parent_id": ""
}
}
'
Result
{
"code": 1000,
"id": 22,
"name": "Question library1"
}
Modifying Different Knowledge Base Category Types
This interface is used to modify existing categories of different types of knowledge bases.
Request Method
PUT /knowledge_catalogs/:id
Request Parameters (URL)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| id | Integer | Yes | Category ID | None |
Request Parameters (Request Body)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| knowledge_catalog | Object | Yes | Knowledge base parameters | None |
The structure of knowledge_catalog is as follows: | ||||
| Parameter Name | Type | Required | Description | Limitations |
| ---------------- | -------- | ---------- | ----------------------- | ----------------------- |
| name | String | Yes | Name of the knowledge base | No more than 255 characters |
| agent_id | Integer | Yes | Agent ID | None |
Notes:
agent_id: Specific agent ID or 0, where 0 represents the administrator.- Only the owner of the category has the permission to make changes. If the agent corresponding to the
agent_idpassed in is not the same person as the owner of the category, the modification cannot be made.
Response Data
| Attribute Name | Type | Description |
|---|---|---|
| code | Integer | Execution result code, 1000 represents success |
| name | String | Name of the new category |
| id | Integer | ID of the new category |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs/11?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2
-X PUT \
-H 'content-type: appliacation/json' \
-d '
{
"knowledge_catalog": {
"name": "Frequently used links",
"agent_id": 0
}
}
'
Result
{
"code": 1000,
"id": 11,
"name": "Frequently used links"
}
Deleting Different Knowledge Base Category Types
This interface is used to delete existing categories of different types of knowledge bases.
Request Method
DELETE /knowledge_catalogs/:id
Request Parameters (URL)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| id | Integer | Yes | Category ID | None |
Request Parameters (Request Body)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| knowledge_catalog | Object | Yes | Knowledge base parameters | None |
The structure of knowledge_catalog is as follows: | ||||
| Parameter Name | Type | Required | Description | Limitations |
| ---------------- | -------- | ---------- | ----------------------- | ----------------------- |
| agent_id | Integer | Yes | Agent ID | None |
Notes:
agent_id: Specific agent ID or 0, where 0 represents the administrator.- Only the owner of the category has the permission to delete. If the agent corresponding to the
agent_idpassed in is not the same person as the owner of the category, the deletion cannot be made.
Response Data
| Attribute Name | Type | Description |
|---|---|---|
| code | Integer | Execution result code, 1000 represents success |
| id | Integer | ID of the deleted category |
| message | String | Information about deleting the category |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs/19?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X DELETE \
-H 'content-type: appliacation/json' \
-d '
{
"knowledge_catalog": {
"agent_id":"0"
}
}
'
Result
{
"code": 1000,
"message": "Category Delete Success",
"id": "19"
}
Getting a List of Different Knowledge Base Categories
This interface is used to get a list of existing categories of different types of knowledge bases.
Request Method
GET /knowledge_catalogs
Request Parameters (Request Body)
| Parameter Name | Type | Required | Description | Limitations |
|---|---|---|---|---|
| knowledge_type_name | String | Yes | English name from knowledge_type | None |
| agent_id | Integer | Yes | Agent ID, default to the administrator | None |
Notes:
agent_id: Specific agent ID or 0, where 0 represents the administrator.- If the value of
agent_idis a valid agent ID, it will get the categories of a certain type of knowledge base for that agent; - If the value of
agent_idis 0, it will get the categories of a certain type of knowledge base for the administrator.
Response Data
| Attribute Name | Type | Description |
|---|---|---|
| code | Integer | Execution result code, 1000 represents success |
| catalogs | Array | List of categories |
The structure of catalogs is as follows: | ||
| Attribute Name | Type | Description |
| ---------------- | --------- | ---------------------------- |
| name | String | Name of the category |
| id | Integer | ID of the category |
| parent_id | Integer | ID of the parent category |
| children | Object | Subcategories of the category |
Example
Request
curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs?email=admin@udesk.cn×tamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2&knowledge_type_name=useful_expression&agent_id=0
Result
{
"code": 1000,
"catalogs": [
{
"id": 4,
"parent_id": 0,
"name": "Common phrases1"
},
{
"id": 5,
"parent_id": 0,
"name": "Common phrases 2",
"children": [
{
"id": 6,
"parent_id": 5,
"name": "Common phrases 1-1"
}
]
}
]
}