logo

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 NameTypeRequiredDescriptionLimitations
knowledge_catalogObjectYesKnowledge base parametersNone
The structure of knowledge_catalog is as follows:
Parameter NameTypeRequiredDescriptionLimitations
---------------------------------------------------------------------------------
nameStringYesName of the knowledge baseNo more than 255 characters
knowledge_type_nameStringYesEnglish name from knowledge_typeNone
parent_idIntegerNoID of the parent categoryNone
agent_idIntegerYesAgent IDNone

Notes:

  • knowledge_type_name: Only the four values of knowledge_type are 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 the agent_id. Other ordinary agents do not have permission to operate this category. If the value of agent_id is 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 NameTypeDescription
codeIntegerExecution result code, 1000 represents success
nameStringName of the new category
idIntegerID of the new category

Example

Request

curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs?email=admin@udesk.cn&timestamp=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 NameTypeRequiredDescriptionLimitations
idIntegerYesCategory IDNone

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionLimitations
knowledge_catalogObjectYesKnowledge base parametersNone
The structure of knowledge_catalog is as follows:
Parameter NameTypeRequiredDescriptionLimitations
--------------------------------------------------------------------------------
nameStringYesName of the knowledge baseNo more than 255 characters
agent_idIntegerYesAgent IDNone

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_id passed in is not the same person as the owner of the category, the modification cannot be made.

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
nameStringName of the new category
idIntegerID of the new category

Example

Request

curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs/11?email=admin@udesk.cn&timestamp=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 NameTypeRequiredDescriptionLimitations
idIntegerYesCategory IDNone

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionLimitations
knowledge_catalogObjectYesKnowledge base parametersNone
The structure of knowledge_catalog is as follows:
Parameter NameTypeRequiredDescriptionLimitations
--------------------------------------------------------------------------------
agent_idIntegerYesAgent IDNone

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_id passed in is not the same person as the owner of the category, the deletion cannot be made.

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
idIntegerID of the deleted category
messageStringInformation about deleting the category

Example

Request

curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs/19?email=admin@udesk.cn&timestamp=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 NameTypeRequiredDescriptionLimitations
knowledge_type_nameStringYesEnglish name from knowledge_typeNone
agent_idIntegerYesAgent ID, default to the administratorNone

Notes:

  • agent_id: Specific agent ID or 0, where 0 represents the administrator.
  • If the value of agent_id is a valid agent ID, it will get the categories of a certain type of knowledge base for that agent;
  • If the value of agent_id is 0, it will get the categories of a certain type of knowledge base for the administrator.

Response Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
catalogsArrayList of categories
The structure of catalogs is as follows:
Attribute NameTypeDescription
-----------------------------------------------------
nameStringName of the category
idIntegerID of the category
parent_idIntegerID of the parent category
childrenObjectSubcategories of the category

Example

Request

curl https://demo.udesk.cn/open_api_v1/knowledge_catalogs?email=admin@udesk.cn&timestamp=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"
                }
            ]
        }
    ]
}