logo

Getting the List of Common Phrases

This interface is used to get all or specified category of common phrases under a certain customer service.

Request Method

GET /useful_expressions

Request Parameters (Query String)

Parameter NameTypeRequiredDescriptionRestrictions
catalog_idIntegerYesCommon phrase category id
agent_idIntegerYesId of the owner of the common phrase category
pageIntegerNoPage number, starting from 1, default is 1
per_pageIntegerNoNumber of items per page, default is 20, maximum is 100
Notes:
  • catalog_id: Specific category id or 0, 0 represents all
  • agent_id: Specific customer service id or 0, 0 represents the administrator

Return Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
useful_expressionsArrayList of common phrases
metaObjectPagination related content, see Common Data

Data structure of useful_expressions

Attribute NameTypeDescription
idIntegerCommon phrase id
contentStringCommon phrase content
catalog_idIntegerCommon phrase category id

Example

Request

curl https://demo.udesk.cn/open_api_v1/useful_expressions?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2&catalog_id=15&agent_id=12

Response

{
    "code": 1000,
    "useful_expressions": [
        {
            "id": 1,
            "content": "content1",
            "catalog_id": 4
        },
        {
            "id": 2,
            "content": "content2",
            "catalog_id": 5
        },
        {
            "id": 3,
            "content": "content2",
            "catalog_id": 6
        },
        {
            "id": 4,
            "content": "content4",
            "catalog_id": 6
        }
    ],
    "meta": {
        "current_page": 1,
        "total_pages": 1,
        "total_count": 4
    }
}

Updating a Common Phrase

This interface is used to modify the content of a specific common phrase.

Request Method

PUT /useful_expressions/:id

Request Parameters (URL)

Parameter NameTypeRequiredDescriptionRestrictions
idIntegerYesCommon phrase id

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionRestrictions
contentStringYesCommon phrase content
agent_idIntegerYesId of the creator of the common phrase
Notes:
  • agent_id value is a specific customer service id or 0, 0 represents the administrator

Return Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
idIntegerCommon phrase id
contentStringCommon phrase content
catalog_idIntegerCommon phrase category id

Example

Request

curl https://demo.udesk.cn/open_api_v1/useful_expressions/4?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 '
{
  "content": "content12",
  "agent_id": 0
}
'

Response

{
    "code": 1000,
    "id": 4,
    "content": "content12",
    "catalog_id": 6
}

Adding a Common Phrase

This interface is used to create a new common phrase under a specific category of a customer service.

Request Method

POST /useful_expressions

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionRestrictions
contentStringYesCommon phrase content
catalog_idIntegerYesCommon phrase category id
agent_idIntegerYesId of the creator of the common phrase
Notes:
  • catalog_id: Specific category id
  • agent_id: Specific customer service id or 0, 0 represents the administrator

Return Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
idIntegerCommon phrase id
contentStringCommon phrase content
catalog_idIntegerCommon phrase category id

Example

Request

curl https://demo.udesk.cn/open_api_v1/useful_expressions?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 '
{
  "content": "kakkakakakakakakaka",
  "agent_id": 0,
  "catalog_id": 6
}
'

Response

{
    "code": 1000,
    "id": 4,
    "content": "kakkakakakakakakaka",
    "catalog_id": 6
}

Deleting a Common Phrase

This interface is used to delete a specific common phrase.

Request Method

DELETE /useful_expressions/:id

Request Parameters (URL)

Parameter NameTypeRequiredDescriptionRestrictions
idIntegerYesCommon phrase id

Request Parameters (Request Body)

Parameter NameTypeRequiredDescriptionRestrictions
agent_idIntegerYesId of the creator of the common phrase

Return Data

Attribute NameTypeDescription
codeIntegerExecution result code, 1000 represents success
idIntegerCommon phrase id
messageStringResult explanation

Example

Request

curl https://demo.udesk.cn/open_api_v1/useful_expressions/4?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 '
{
  "agent_id": 0
}
'

Response

{
    "code": 1000,
    "message": "Common phrase deleted successfully",
    "id": "4"
}