logo

Template Deletion API

Request Endpoint

  • DELETE /v1/datumTemplates/:id

Request Parameters

Request parameters

ParameterTypeOptionalDescription
idIntegerfalseTemplate ID

Response Result

  • None, HTTP response code is 204 when deletion is successful

Example

$ curl 'https://km.udesk.cn/api/v1/datumTemplates/57?email=admin@udesk.cn&timestamp=1573026139&sign=31322f38618d50ee671ef073305ac9917e652374' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json'

Get Template Details API

Request Endpoint

  • GET /v1/datumTemplates/:id

Request Parameters

Request fields

pathTypeOptionalDescription
idIntegerfalseTemplate ID.

Response Result

PathTypeDescription
codeIntegerExecution result code.
messageStringExecution result description
dataObjectTemplate information
data[].idIntegerTemplate ID
data[].nameStringTemplate name
data[].robotIdIntegerRobot ID
data[].ordersIntegerTemplate order
data[].parentIdIntegerParent template ID (if it's a top-level template, it's 0, otherwise it's a specific ID)
data[].remarkStringTemplate description (description length should not exceed 255 characters).
data[].questionAndAnswerSetIntegerTemplate QA settings (0. None 1. Default Reply 2. Clarification 4. Recommendation 8. Search)
data[].similarList[]StringTemplate aliases
data[].attributesArrayTemplate attribute list.
data[].attributes[].idIntegerTemplate attribute ID
data[].attributes[].robotIdIntegerRobot ID
data[].attributes[].templateIdIntegerTemplate ID
data[].attributes[].nameStringTemplate attribute name
data[].attributes[].allowInheritedIntegerWhether the template allows inheritance (0. No inheritance 1. Can inherit)
data[].attributes[].answerStringAttribute name
data[].attributes[].askBackStringAttribute probing method
data[].attributes[].askBackFlagIntegerAttribute probing method type
data[].attributes[].switchStatusIntegerAttribute switch (0. Off 1. On)
data[].attributes[].similarList[]StringAttribute aliases
data[].attributes[].expressionList[]StringAttribute expressions
data[].datumDefaultAnswerArrayDefault reply for the datum
data[].datumDefaultAnswer.idIntegerID
data[].datumDefaultAnswer.robotIdIntegerRobot ID
data[].datumDefaultAnswer.templateIdIntegerTemplate ID
data[].datumDefaultAnswer.answerTypeIntegerReply type (1. Partial attributes 2. Trigger attribute probing 3. All attributes)
data[].datumDefaultAnswer.attributeIdList[]IntegerAttribute ID
data[].datumRecommendationArrayDatum recommendation
data[].datumRecommendation.idIntegerDatum ID
data[].datumRecommendation.robotIdIntegerRobot ID
data[].datumRecommendation.templateIdIntegerTemplate ID
data[].datumRecommendation.noResultContentStringResponse when there is no result
data[].datumRecommendation.recommendationNumberIntegerNumber of recommended data
data[].datumSearchArrayDatum search
data[].datumSearch.idIntegerID
data[].datumSearch.robotIdIntegerRobot ID
data[].datumSearch.templateIdIntegerTemplate ID
data[].datumSearch.noResultContentStringResponse when there is no result
data[].datumSearch.recommendationNumberIntegerNumber of recommended data
data[].datumSearch.strategiesArrayDatum search strategies
data[].datumSearch.strategies[].idIntegerID
data[].datumSearch.strategies[].robotIdIntegerRobot ID
data[].datumSearch.strategies[].templateIdIntegerTemplate ID
data[].datumSearch.strategies[].datumSearchIdIntegerDatum search ID
data[].datumSearch.strategies[].nameStringStrategy name
data[].datumSearch.strategies[].remarkStringStrategy description
data[].datumSearch.strategies[].clarificationAskContentStringSearch strategy question
data[].datumSearch.strategies[].retrievalTargetIntegerRetrieval target 1: Get attribute 2: Get knowledge
data[].datumSearch.strategies[].attributeIdIntegerAttribute ID When the retrieval target is to obtain the attribute, it is required (only one can be selected), not filled when getting knowledge, retrieving all data
data[].datumSearch.strategies[].clarificationContentStringClarification response
data[].datumSearch.strategies[].clarificationRoundsStringClarification rounds
data[].datumSearch.strategies[].failureContentStringFailure response
data[].datumSearch.strategies[].ordersIntegerPriority sorting

Example

$ curl 'https://km.udesk.cn/api/v1/datumTemplates/56?email=admin@udesk.cn&timestamp=1559022283&sign=aa8164470dff8468e6129c1e7d5767651cdedd7c' -i -X GET -H 'Content-Type: application/json' -H 'Accept: application/json'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "data": {
        "id": 56,
        "name": "Template",
        "robotId": 83,
        "orders": 1,
        "parentId": 21,
        "parentIds": "0-21",
        "remark": "Template description",
        "questionAndAnswerSet": 15,
        "attributes": [
            {
                "id": 135,
                "name": "Attribute1",
                "robotId": 83,
                "templateId": 56,
                "similarList": [
                    "Attribute1_alias",
                    "Attribute1_alias2"
                ],
                "askBack": "Which Attribute1 do you want to know?",
                "askBackFlag": 0,
                "orders": 1,
                "allowInherited": 1,
                "switchStatus": 1,
                "answer": "<p>Attribute1 value</p>",
                "expressionList": [
                    "Expression1",
                    "Expression2"
                ]
            },
            {
                "id": 136,
                "name": "Attribute2",
                "robotId": 83,
                "templateId": 56,
                "similarList": [
                    "Attribute2_alias",
                    "Attribute2_alias2"
                ],
                "askBack": "Which Attribute2 do you want to know?",
                "askBackFlag": 0,
                "orders": 2,
                "allowInherited": 1,
                "switchStatus": 1,
                "answer": "<p>Attribute2 value</p>",
                "expressionList": [
                    "Expression3",
                    "Expression4"
                ]
            }
        ],
        "similarList": [
            "Template_alias"
        ],
        "datums": [],
        "datumDefaultAnswer": {
            "id": 8,
            "answerType": 3,
            "robotId": 83,
            "templateId": 56,
            "attributeIdList": [
                null
            ]
        },
        "datumRecommendation": {
            "id": 3,
            "robotId": 83,
            "templateId": 56,
            "recommendationNumber": 3,
            "noResultContent": "Sorry, we couldn't find any data based on your criteria, please rephrase your question"
        },
        "datumSearch": {
            "id": 3,
            "robotId": 83,
            "templateId": 56,
            "recommendationNumber": 3,
            "noResultContent": "Sorry, we couldn't find any data based on your criteria, please rephrase your question",
            "strategies": [
                {
                    "id": 2,
                    "robotId": 83,
                    "templateId": 56,
                    "datumSearchId": 3,
                    "name": "Strategy2",
                    "remark": "Strategy2 description",
                    "retrievalTarget": 2,
                    "attributeId": null,
                    "clarificationAskContent": "Is this Strategy2?",
                    "clarificationContent": "Strategy2 clarification tree",
                    "clarificationRounds": 2,
                    "failureContent": "Sorry, search failed, please rephrase your question",
                    "orders": 1
                },
                {
                    "id": 3,
                    "robotId": 83,
                    "templateId": 56,
                    "datumSearchId": 3,
                    "name": "Search Strategy",
                    "remark": "Search Strategy description",
                    "retrievalTarget": 2,
                    "attributeId": null,
                    "clarificationAskContent": "Search strategy question",
                    "clarificationContent": "Clarification tree",
                    "clarificationRounds": 2,
                    "failureContent": "Sorry, search failed, please rephrase your question",
                    "orders": 2
                }
            ]
        }
    }
}

Request Failure Reasons

messagedescription
"The data has been deleted or does not exist"The template corresponding to the ID does not exist.

New Template Interface

Request Address

  • POST /v1/datumTemplates

Request Parameters

Request fields

PathTypeOptionalDescription
nameStringfalseTemplate Name
robotIdIntegerfalseRobot ID
parentIdIntegerfalseInherited Template (if it's a top-level template, set to 0, for non-top-level templates, pass the parent template ID)
remarkStringtrueTemplate Description (Description length cannot exceed 255 characters)
questionAndAnswerSetIntegerfalseTemplate Question and Answer Set (0. None 1. Default Reply 2. Clarification 4. Recommendation 8. Search)
similarList[]StringtrueAlias
attributesArraytrueAttribute List
attributes[].nameStringtrueAttribute Name
attributes[].allowInheritedIntegerfalseAllow Inheritance (0. Do not inherit 1. Can inherit)
attributes[].answerStringtrueAttribute Value
attributes[].askBackStringtrueAsk-back Method
attributes[].askBackFlagIntegertrueAsk-back Method Type
attributes[].switchStatusIntegerfalseAttribute Switch (0. Off 1. On)
attributes[].changeTypeIntegerfalseChange Type (0. No Change 1. Add 2. Update 3. Delete)
attributes[].similarList[]StringtrueAttribute Alias
attributes[].expressionList[]StringtrueAttribute Expression
datumDefaultAnswerArraytrueDefault Replies
datumDefaultAnswer.answerTypeIntegerfalseReply Type (1. Partial Attributes 2. Trigger Attribute Ask-back 3. All Attributes)
datumDefaultAnswer.attributeIdList[]IntegertrueAttribute ID (mandatory when reply type is not all attributes)
datumRecommendationArraytrueRecommendations
datumRecommendation.noResultContentStringfalseNo Result Content
datumRecommendation.recommendationNumberIntegerfalseNumber of Recommended Knowledge Points
datumSearchObjecttrueKnowledge Point Search
datumSearch.noResultContentStringfalseNo Result Content
datumSearch.recommendationNumberIntegerfalseNumber of Recommended Knowledge Points
datumSearch.strategiesArraytrueSearch Strategies
datumSearch.strategies[].nameStringfalseStrategy Name
datumSearch.strategies[].remarkStringtrueStrategy Description
datumSearch.strategies[].clarificationAskContentStringfalseClarification Ask Content
datumSearch.strategies[].retrievalTargetIntegerfalseRetrieval Target (1: Get Attributes 2: Get Knowledge)
datumSearch.strategies[].attributeIdIntegertrueAttribute ID (mandatory when retrieval target is to get attributes, only one can be selected), not required when getting knowledge, search all knowledge points
datumSearch.strategies[].clarificationContentStringtrueClarification Content
datumSearch.strategies[].clarificationRoundsStringtrueClarification Rounds
datumSearch.strategies[].failureContentStringtrueFailure Content
datumClarifyObjecttrueKnowledge Point Clarification
datumClarify.robotIdIntegertrueRobot ID
datumClarify.templateIdIntegertrueTemplate ID
datumClarify.recommendationNumberIntegertrueNumber of Recommended Knowledge Points
datumClarify.noResultContentStringtrueNo Result Content
datumClarify.clarifyTypeIntegertrueSearch Strategy 1. Attribute Ask-back 2. Strategy Follow-up
datumClarify.askTypeStringtrueSearch Type 1. Priority 2. Intelligent Search
datumClarify.strategiesArraytrueStrategy Name
datumClarify.strategies[].robotIdIntegertrueRobot ID
datumClarify.strategies[].templateIdIntegertrueTemplate ID
datumClarify.strategies[].datumClarifyIdIntegertrueKnowledge Point Clarification ID
datumClarify.strategies[].nameStringtrueStrategy Name
datumClarify.strategies[].remarkStringtrueStrategy Description
datumClarify.strategies[].clarificationAskContentStringtrueClarification Ask Content
datumClarify.strategies[].retrievalTargetIntegertrueRetrieval Target 1: Get Attributes 2: Get Knowledge
datumClarify.strategies[].attributeIdIntegertrueAttribute ID (mandatory when retrieval target is to get attributes, only one can be selected), not required when getting knowledge, search all knowledge points
datumClarify.strategies[].alternativePushContentObjecttrueAlternative Push Switch
datumClarify.strategies[].alternativePushStatus.chosenIntegertrueSelected Style 0 1 2
datumClarify.strategies[].alternativePushStatus.styleStringtrueStyle Template
datumClarify.strategies[].alternativePushStatus.labelListArraytrueLabel List
datumClarify.strategies[].alternativePushStatus.labelList[].idIntegertrueLabel ID
datumClarify.strategies[].alternativePushStatus.labelList[].nameIntegertrueLabel Name
datumClarify.strategies[].alternativePushStatus.labelList[].contentIntegertrueLabel Content
datumClarify.strategies[].clarificationContentStringtrueClarification Content
datumClarify.strategies[].clarificationRoundsStringtrueClarification Rounds
datumClarify.strategies[].failureContentStringtrueFailure Content
datumClarify.strategies[].ordersIntegertrueOrder Priority

Request Result

PathTypeDescription
codeIntegerExecution Result Code
messageStringExecution Result Description
dataObjectTemplate Information
data[].idIntegerTemplate ID
data[].nameStringTemplate Name
data[].robotIdIntegerRobot ID
data[].ordersIntegerOrder
data[].parentIdIntegerInherited Template
data[].remarkStringTemplate Description
data[].questionAndAnswerSetIntegerTemplate Question and Answer Set (0. None 1. Default Reply 2. Clarification 4. Recommendation 8. Search)
data[].similarList[]StringAlias
data[].attributesArrayAttribute List
data[].attributes[].idIntegerID
data[].attributes[].robotIdIntegerRobot ID
data[].attributes[].templateIdIntegerTemplate ID
data[].attributes[].nameStringAttribute Name
data[].attributes[].allowInheritedIntegerAllow Inheritance (0. Do not inherit 1. Can inherit)
data[].attributes[].answerStringAttribute Value
data[].attributes[].askBackStringAsk-back Method
data[].attributes[].askBackFlagIntegerAsk-back Method Type
data[].attributes[].switchStatusIntegerAttribute Switch (0. Off 1. On)
data[].attributes[].changeTypeIntegerChange Type (0. No Change 1. Add 2. Update 3. Delete)
data[].attributes[].similarList[]StringAttribute Alias
data[].attributes[].expressionList[]StringAttribute Expression
data[].datumDefaultAnswerArrayData Default Reply
data[].datumDefaultAnswer.idIntegerID
data[].datumDefaultAnswer.robotIdIntegerRobot ID
data[].datumDefaultAnswer.templateIdIntegerTemplate ID
data[].datumDefaultAnswer.answerTypeIntegerReply Type (1. Partial Attributes 2. Trigger Attribute Ask-back 3. All Attributes)
data[].datumDefaultAnswer.attributeIdList[]IntegerAttribute ID (mandatory when reply type is not all attributes)
data[].datumRecommendationArrayKnowledge Point Recommendation
data[].datumRecommendation.idIntegerID
data[].datumRecommendation.robotIdIntegerRobot ID
data[].datumRecommendation.templateIdIntegerTemplate ID
data[].datumRecommendation.noResultContentStringNo Result Content
data[].datumRecommendation.recommendationNumberIntegerNumber of Recommended Knowledge Points
data[].datumSearchArrayKnowledge Point Search
data[].datumSearch.idIntegerID
data[].datumSearch.robotIdIntegerRobot ID
data[].datumSearch.templateIdIntegerTemplate ID
data[].datumSearch.noResultContentStringNo Result Content
data[].datumSearch.recommendationNumberIntegerNumber of Recommended Knowledge Points
data[].datumSearch.strategiesArrayKnowledge Point Search Strategy
data[].datumSearch.strategies[].idIntegerID
data[].datumSearch.strategies[].robotIdIntegerRobot ID
data[].datumSearch.strategies[].templateIdIntegerTemplate ID
data[].datumSearch.strategies[].datumSearchIdIntegerKnowledge Point Search ID
data[].datumSearch.strategies[].nameStringStrategy Name
data[].datumSearch.strategies[].remarkStringStrategy Description
data[].datumSearch.strategies[].clarificationAskContentStringClarification Ask Content
data[].datumSearch.strategies[].retrievalTargetIntegerRetrieval Target (1. Get Attributes 2. Get Knowledge)
data[].datumSearch.strategies[].attributeIdIntegerAttribute ID (mandatory when retrieval target is to get attributes, only one can be selected), not required when getting knowledge, search all knowledge points
data[].datumSearch.strategies[].clarificationContentStringClarification Content
data[].datumSearch.strategies[].clarificationRoundsStringClarification Rounds
data[].datumSearch.strategies[].failureContentStringFailure Content
data[].datumClarifyObjectKnowledge Point Clarification
data[].datumClarify.robotIdIntegerRobot ID
data[].datumClarify.templateIdIntegerTemplate ID
data[].datumClarify.recommendationNumberIntegerNumber of Recommended Knowledge Points
data[].datumClarify.noResultContentStringNo Result Content
data[].datumClarify.clarifyTypeIntegerSearch Strategy 1. Attribute Ask-back 2. Strategy Follow-up
data[].datumClarify.askTypeStringSearch Type 1. Priority 2. Intelligent Search
data[].datumClarify.strategiesArrayStrategy Name
data[].datumClarify.strategies[].robotIdIntegerRobot ID
data[].datumClarify.strategies[].templateIdIntegerTemplate ID
data[].datumClarify.strategies[].datumClarifyIdIntegerKnowledge Point Clarification ID
data[].datumClarify.strategies[].nameStringStrategy Name
data[].datumClarify.strategies[].remarkStringStrategy Description
data[].datumClarify.strategies[].clarificationAskContentStringClarification Ask Content
data[].datumClarify.strategies[].retrievalTargetIntegerRetrieval Target (1: Get Attributes 2: Get Knowledge)
data[].datumClarify.strategies[].attributeIdIntegerAttribute ID (mandatory when retrieval target is to get attributes, only one can be selected), not required when getting knowledge, search all knowledge points
data[].datumClarify.strategies[].alternativePushContentObjectAlternative Push Switch
data[].datumClarify.strategies[].alternativePushStatus.chosenIntegerSelected Style 0 1 2
data[].datumClarify.strategies[].alternativePushStatus.styleStringStyle Template
data[].datumClarify.strategies[].alternativePushStatus.labelListArrayLabel List
data[].datumClarify.strategies[].alternativePushStatus.labelList[].idIntegerLabel ID
data[].datumClarify.strategies[].alternativePushStatus.labelList[].nameIntegerLabel Name
data[].datumClarify.strategies[].alternativePushStatus.labelList[].contentIntegerLabel Content
data[].datumClarify.strategies[].clarificationContentStringClarification Content
data[].datumClarify.strategies[].clarificationRoundsStringClarification Rounds
data[].datumClarify.strategies[].failureContentStringFailure Content
data[].datumClarify.strategies[].ordersIntegerOrder Priority

Example

$ curl 'https://km.udesk.cn/api/v1/datumTemplates?email=admin@udesk.cn&timestamp=1559016113&sign=f16d7f6fcc3fbab73855f4510cd4904f0f60e258' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
	"name": "Small Template",
	"robotId": 83,
	"similarList": ["Template Alias"],
	"parentId": 21,
	"remark": "Template Description",
	"questionAndAnswerSet": 15,
	"attributes": [{
		"name": "Template Attribute 2",
		"similarList": ["Template Attribute 2 Alias", "Template Attribute 2 Alias 2"],
		"allowInherited": 1,
		"answer": "<p>Template Attribute 2 Value</p>",
		"askBack": "Which template attribute 2 do you want to know about?",
		"askBackFlag": 0,
		"switchStatus": 1,
		"expressionList": ["Hello", "haha"],
		"changeType": 1
	}, {
		"name": "Template Attribute",
		"similarList": ["Template Attribute Alias", "Template Attribute Alias 2"],
		"allowInherited": 1,
		"answer": "<p>Template Attribute Value</p>",
		"askBack": "Which template attribute do you want to know about?",
		"askBackFlag": 0,
		"switchStatus": 1,
		"expressionList": ["Template Attribute Expression", "Template Attribute Expression 2"],
		"changeType": 1
	}],
	"datumDefaultAnswer": {
		"answerType": 3
	},
	"datumRecommendation": {
		"noResultContent": "Sorry, cannot find knowledge points based on your criteria, please ask again",
		"recommendationNumber": 3
	},
	"datumSearch": {
		"noResultContent": "Sorry, cannot find knowledge points based on your criteria, please ask again",
		"recommendationNumber": 3,
		"strategies": [{
			"name": "Strategy 2",
			"remark": "Strategy 2 Description",
			"clarificationAskContent": "Strategy 2 Clarification Ask",
			"retrievalTarget": 2,
			"clarificationContent": "Strategy 2 Clarification Content",


			"clarificationRounds": 2,
			"failureContent": "Sorry, search failed, please ask again"
		}, {
			"name": "Search Strategy",
			"remark": "Search Strategy Description",
			"clarificationAskContent": "Search Strategy Clarification Ask",
			"retrievalTarget": 2,
			"clarificationContent": "Search Strategy Clarification Content",
			"clarificationRounds": 2,
			"failureContent": "Sorry, search failed, please ask again"
		}]
	}
}'  
  
Return
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "data": {
        "id": 56,
        "name": "Small Template",
        "robotId": 83,
        "orders": 1,
        "parentId": 21,
        "parentIds": "0-21",
        "remark": "Template Description",
        "questionAndAnswerSet": 15,
        "attributes": [
            {
                "id": 135,
                "name": "Template Attribute 2",
                "robotId": 83,
                "templateId": 56,
                "similarList": [
                    "Template Attribute 2 Alias",
                    "Template Attribute 2 Alias 2"
                ],
                "askBack": "Which template attribute 2 do you want to know about?",
                "askBackFlag": 0,
                "orders": 1,
                "allowInherited": 1,
                "switchStatus": 1,
                "answer": "<p>Template Attribute 2 Value</p>",
                "expressionList": [
                    "Hello",
                    "haha"
                ]
            },
            {
                "id": 136,
                "name": "Template Attribute",
                "robotId": 83,
                "templateId": 56,
                "similarList": [
                    "Template Attribute Alias",
                    "Template Attribute Alias 2"
                ],
                "askBack": "Which template attribute do you want to know about?",
                "askBackFlag": 0,
                "orders": 2,
                "allowInherited": 1,
                "switchStatus": 1,
                "answer": "<p>Template Attribute Value</p>",
                "expressionList": [
                    "Template Attribute Expression",
                    "Template Attribute Expression 2"
                ]
            }
        ],
        "similarList": [
            "Template Alias"
        ],
        "datums": [],
        "datumDefaultAnswer": {
            "id": null,
            "answerType": 3,
            "robotId": 83,
            "templateId": 56,
            "attributeIdList": null
        },
        "datumRecommendation": {
            "id": 3,
            "robotId": 83,
            "templateId": 56,
            "recommendationNumber": 3,
            "noResultContent": "Sorry, cannot find knowledge points based on your criteria, please ask again"
        },
        "datumSearch": {
            "id": 3,
            "robotId": 83,
            "templateId": 56,
            "recommendationNumber": 3,
            "noResultContent": "Sorry, cannot find knowledge points based on your criteria, please ask again",
            "strategies": [
                {
                    "id": 1,
                    "robotId": 83,
                    "templateId": 56,
                    "datumSearchId": 3,
                    "name": "Strategy 2",
                    "remark": "Strategy 2 Description",
                    "retrievalTarget": 2,
                    "attributeId": 1,
                    "clarificationAskContent": "Strategy 2 Clarification Ask",
                    "clarificationContent": "Strategy 2 Clarification Content",
                    "clarificationRounds": 2,
                    "failureContent": "Sorry, search failed, please ask again",
                    "orders": 1
                },
                {
                    "id": 2,
                    "robotId": 83,
                    "templateId": 56,
                    "datumSearchId": 3,
                    "name": "Search Strategy",
                    "remark": "Search Strategy Description",
                    "retrievalTarget": 2,
                    "attributeId": 2,
                    "clarificationAskContent": "Search Strategy Clarification Ask",
                    "clarificationContent": "Search Strategy Clarification Content",
                    "clarificationRounds": 2,
                    "failureContent": "Sorry, search failed, please ask again",
                    "orders": 2
                }
            ]
        }
    }
}

Update Template Interface

Request Address

  • PUT /v1/datumTemplates/:id

Request Parameters

Request Fields

pathTypeOptionalDescription
idIntegerfalseID
nameStringfalseTemplate Name
robotIdIntegerfalseRobot ID.
ordersIntegertrueSorting
parentIdIntegerfalseInherited Template (If it is a top-level template, it is 0. For non-top-level templates, the parent template ID needs to be passed)
remarkStringtrueTemplate Description (Description length cannot exceed 255 characters)
questionAndAnswerSetIntegerfalseTemplate QA Setting (0. None, 1. Default Reply, 2. Clarification, 4. Recommendation, 8. Search)
similarList[]StringtrueAlias
attributesArraytrueAttribute List
attributes[].idIntegerfalseID
attributes[].robotIdIntegerfalseRobot ID
attributes[].templateIdIntegerfalseTemplate ID
attributes[].nameStringtrueAttribute Name
attributes[].allowInheritedIntegerfalseWhether to Allow Inheritance (0. Not Inherited, 1. Inheritable)
attributes[].answerStringtrueAttribute Value()
attributes[].askBackStringtruePrompt for Clarification
attributes[].askBackFlagIntegertruePrompt for Clarification Type
attributes[].switchStatusIntegerfalseAttribute Switch (0. Off, 1. On)
attributes[].changeTypeIntegerfalseModification Type (0. No Modification, 1. Add, 2. Update, 3. Delete)
attributes[].similarList[]StringtrueAttribute Alias
attributes[].expressionList[]StringtrueAttribute Expression
datumDefaultAnswerArraytrueDefault Reply from Data Base
datumDefaultAnswer.idIntegerfalseID
datumDefaultAnswer.robotIdIntegerfalseRobot ID
datumDefaultAnswer.templateIdIntegerfalseTemplate ID
datumDefaultAnswer.answerTypeIntegerfalseReply Type (1. Partial Attributes, 2. Trigger Attribute Clarification, 3. All Attributes)
datumDefaultAnswer.attributeIdList[]IntegertrueAttribute ID (Required when reply type is not all attributes)
datumRecommendationArraytrueKnowledge Recommendation
datumRecommendation.idIntegerfalseID
datumRecommendation.robotIdIntegerfalseRobot ID
datumRecommendation.templateIdIntegerfalseTemplate ID
datumRecommendation.noResultContentStringfalseResponse when there is no result
datumRecommendation.recommendationNumberIntegerfalseNumber of recommended knowledge points
datumSearchArraytrueKnowledge Search
datumSearch.idIntegerfalseID
datumSearch.robotIdIntegerfalseRobot ID
datumSearch.templateIdIntegerfalseTemplate ID
datumSearch.noResultContentStringfalseResponse when there is no result
datumSearch.recommendationNumberIntegerfalseNumber of recommended knowledge points
datumSearch.strategiesArraytrueKnowledge Search Strategies
datumSearch.strategies[].idIntegerfalseID
datumSearch.strategies[].robotIdIntegerfalseRobot ID
datumSearch.strategies[].templateIdIntegerfalseTemplate ID
datumSearch.strategies[].datumSearchIdIntegerfalseKnowledge Search ID
datumSearch.strategies[].nameStringfalseStrategy Name
datumSearch.strategies[].remarkStringtrueStrategy Description
datumSearch.strategies[].clarificationAskContentStringfalseSearch Strategy Prompt
datumSearch.strategies[].retrievalTargetIntegerfalseRetrieval Target 1. Get Attribute 2. Get Knowledge
datumSearch.strategies[].attributeIdIntegertrueAttribute ID (Required when retrieval target is to get attribute (only one can be selected), not required when getting knowledge, retrieve all knowledge points)
datumSearch.strategies[].clarificationContentStringtrueClarification Speech
datumSearch.strategies[].clarificationRoundsStringtrueClarification Rounds
datumSearch.strategies[].failureContentStringtrueFailure Speech
datumClarifyObjecttrueKnowledge Clarification
datumClarify.robotIdIntegertrueRobot ID
datumClarify.templateIdIntegertrueTemplate ID
datumClarify.recommendationNumberIntegertrueNumber of Knowledge Recommendations
datumClarify.noResultContentStringtrueResponse when there is no result
datumClarify.clarifyTypeIntegertrueSearch Strategy 1 Attribute Clarification 2 Strategy Follow-up Question
datumClarify.askTypeStringtrueSearch Type 1 Priority 2 Intelligent Search
datumClarify.strategiesArraytrueStrategy Name
datumClarify.strategies[].robotIdIntegertrueRobot ID
datumClarify.strategies[].templateIdIntegertrueTemplate ID
datumClarify.strategies[].datumClarifyIdIntegertrueKnowledge Clarification ID
datumClarify.strategies[].nameStringtrueStrategy Name
datumClarify.strategies[].remarkStringtrueStrategy Description
datumClarify.strategies[].clarificationAskContentStringtrueSearch Strategy Prompt
datumClarify.strategies[].retrievalTargetIntegertrueRetrieval Target 1: Get Attribute 2: Get Knowledge
datumClarify.strategies[].attributeIdIntegertrueAttribute ID Required when retrieval target is to get attribute (only one can be selected), not required when getting knowledge, retrieve all knowledge points
datumClarify.strategies[].alternativePushContentObjecttrueAlternative Push Switch
datumClarify.strategies[].alternativePushStatus.chosenIntegertrueSelected Style 0 1 2
datumClarify.strategies[].alternativePushStatus.styleStringtrueStyle Template
datumClarify.strategies[].alternativePushStatus.labelListArraytrueLabel List
datumClarify.strategies[].alternativePushStatus.labelList[].idIntegertrueLabel ID
datumClarify.strategies[].alternativePushStatus.labelList[].nameIntegertrueLabel Name
datumClarify.strategies[].alternativePushStatus.labelList[].contentIntegertrueLabel Content
datumClarify.strategies[].clarificationContentStringtrueClarification Speech
datumClarify.strategies[].clarificationRoundsStringtrueClarification Rounds
datumClarify.strategies[].failureContentStringtrueFailure Speech
datumClarify.strategies[].ordersIntegertrueSorting Priority

Request Result

PathTypeDescription
codeIntegerStatus Code
messageStringReturn Message
visibleBoolean
dataObjectReturn Content

Example

$ curl 'https://km.udesk.cn/api/v1/datumTemplates/56?email=admin@udesk.cn&timestamp=1559022283&sign=aa8164470dff8468e6129c1e7d5767651cdedd7c' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -

d '{
    "id":56,
    "name": "Tiny Template",
    "robotId": 83,
    "similarList": ["Template Alias"],
    "parentId": 21,
    "remark": "Template Description",
    "questionAndAnswerSet": 15,
    "attributes": [{
        "name": "Template Attribute 2",
        "similarList": ["Template Attribute 2 Alias", "Template Attribute 2 Alias 2"],
        "allowInherited": 1,
        "answer": "<p>Template Attribute 2 Value</p>",
        "askBack": "Which do you want to know about for testing the creation of Template Attribute 2?",
        "askBackFlag": 0,
        "switchStatus": 1,
        "expressionList": ["Hello", "haha"],
        "changeType": 1
    }, {
        "name": "Template Attribute",
        "similarList": ["Template Attribute Alias", "Template Attribute Alias 2"],
        "allowInherited": 1,
        "answer": "<p>Template Attribute Value</p>",
        "askBack": "Which do you want to know about for testing the creation of Template Attribute?",
        "askBackFlag": 0,
        "switchStatus": 1,
        "expressionList": ["Template Attribute Expression", "Template Attribute Expression 2"],
        "changeType": 1
    }],
    "datumDefaultAnswer": {
        "answerType": 3
    },
    "datumRecommendation": {
        "noResultContent": "Sorry, no knowledge point found based on your criteria, please rephrase",
        "recommendationNumber": 3
    },
    "datumSearch": {
        "noResultContent": "Sorry, no knowledge point found based on your criteria, please rephrase",
        "recommendationNumber": 3,
        "strategies": [{
            "name": "Strategy 2",
            "remark": "Strategy 2 Description",
            "clarificationAskContent": "Yes, Strategy 2 Description",
            "retrievalTarget": 2,
            "clarificationContent": "Strategy 2 Clarification Tree",
            "clarificationRounds": 2,
            "failureContent": "Sorry, search failed, please rephrase"
        }, {
            "name": "Search Strategy",
            "remark": "Search Strategy Description",
            "clarificationAskContent": "Search Query",
            "retrievalTarget": 2,
            "clarificationContent": "Clarification Tree",
            "clarificationRounds": 2,
            "failureContent": "Sorry, search failed, please rephrase"
        }]
    }
}'


Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "exception":null,
    "paging":null,
    "data": null
}

Get Template List Interface

Request Address

  • POST /v1/datumTemplates/search

Request Parameters

Request Fields

PathTypeOptionalDescription
pageNumIntegertruePage Number
pageSizeIntegertrueNumber per Page
robotIdIntegerfalseRobot ID
leafFlagIntegertrueTemplate Type (1. Leaf Template 2. All Templates) (default is leaf template)
keywordStringtrueKeyword Search

Request Result

PathTypeDescription
codeIntegerStatus Code
messageStringReturn Message
dataObjectReturn Content
data[].idIntegerTemplate ID
data[].nameStringTemplate Name
data[].robotIdIntegerRobot ID
data[].parentIdIntegerParent Template ID
data[].leafFlagIntegerWhether it is a leaf template (0. No, 1. Yes)
data[].rootIdIntegerRoot Template ID
data[].remarkStringTemplate Description
data[].questionAndAnswerSetIntegerTemplate QA Setting (0. None, 1. Default Reply, 2. Clarification, 4. Recommendation, 8. Search)
data[].similarList[]StringTemplate Alias

Example

$ curl 'https://km.udesk.cn/api/v1/datumTemplates/search?email=admin@udesk.cn&timestamp=1578367138&sign=4e6cfa92d0ef5f5ed214e7dfa4be766cc1b86254' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
    "pageNum":1,
    "pageSize":10,
    "robotId":83,
    "keyword":"Country"
}'  
  
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 1
    },
    "data": [
        {
            "id": 127,
            "name": "Country",
            "robotId": 83,
            "parentId": 0,
            "remark": "",
            "questionAndAnswerSet": 15,
            "leafFlag": 1,
            "rootId": 127,
            "similarList": []
        }
    ]
}

Knowledge Deletion Interface

Request Address

  • DELETE /v1/datums/:id

Request Parameters

Request parameters

ParameterTypeOptionalDescription
idIntegerfalseKnowledge ID

Request Result

  • None, successful deletion, HTTP response code is 204

Example

$ curl 'https://km.udesk.cn/api/v1/datums/2?email=admin@udesk.cn&timestamp=1573026139&sign=31322f38618d50ee671ef073305ac9917e652374' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json'

Get Knowledge Details Interface

Request Address

  • GET /v1/datums/:id

Request Parameters

Request fields

PathTypeOptionalDescription
idIntegerfalseKnowledge ID

Request Result

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataObjectKnowledge information
data[].idArrayKnowledge ID
data[].robotIdIntegerRobot ID
data[].nameStringKnowledge Name
data[].displayNameStringKnowledge Display Name
data[].templateIdIntegerTemplate ID
data[].templateNameStringTemplate Name
data[].similarList[]StringSynonyms
data[].categoryIdIntegerCategory ID
data[].ordersIntegerSort ID
data[].attributesArrayKnowledge attribute values
data[].attributes[].idIntegerID
data[].attributes[].nameStringAttribute Name
data[].attributes[].robotIdIntegerRobot ID
data[].attributes[].datumIdIntegerKnowledge ID
data[].attributes[].templateIdIntegerTemplate ID
data[].attributes[].templateAttributeIdIntegerTemplate Attribute ID
data[].attributes[].switchStatusIntegerWhether it is open (0. Off, 1. On)
data[].attributes[].answerStringRich text answer
data[].attributes[].srcTypeIntegerSource type (0. Customized, 1. Inherit template attribute value)

Example

$ curl 'https://km.udesk.cn/api/v1/datums/2?email=admin@udesk.cn&timestamp=1559022283&sign=aa8164470dff8468e6129c1e7d5767651cdedd7c' -i -X GET -H 'Content-Type: application/json' -H 'Accept: application/json'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "data": {
        "id": 1,
        "name": "Udesk Test Name",
        "similarList": [],
        "robotId": 83,
        "templateId": 45,
        "templateName": "Udesk Test Template",
        "categoryId": 23,
        "orders": null,
        "category": null,
        "attributes": [
            {
                "id": 330,
                "name": "Udesk Knowledge Name",
                "robotId": 83,
                "datumId": 1,
                "templateId": 45,
                "templateAttributeId": 53,
                "switchStatus": null,
                "answer": "Udesk Knowledge Answer",
                "srcType": 0
            }
        ]
    }
}

Create Knowledge Interface

Request Address

  • POST /v1/datums

Request Parameters

Request fields

PathTypeOptionalDescription
robotIdIntegerfalseRobot ID
nameStringfalseKnowledge Name
templateIdIntegerfalseTemplate ID
categoryIdIntegerfalseCategory ID
displayNameStringfalseKnowledge Display Name

Request Result

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataObjectKnowledge information
data[].idArrayKnowledge ID
data[].robotIdIntegerRobot ID
data[].nameStringKnowledge Name
data[].displayNameStringKnowledge Display Name
data[].templateIdIntegerTemplate ID
data[].templateNameStringTemplate Name
data[].similarList[]StringSynonyms
data[].categoryIdIntegerCategory ID
data[].ordersIntegerSort ID
data[].attributesArrayKnowledge attribute values
data[].attributes[].idIntegerKnowledge attribute value ID
data[].attributes[].nameStringAttribute Name
data[].attributes[].robotIdIntegerRobot ID
data[].attributes[].datumIdIntegerKnowledge ID
data[].attributes[].templateIdIntegerTemplate ID
data[].attributes[].templateAttributeIdIntegerTemplate Attribute ID
data[].attributes[].switchStatusIntegerWhether it is open (0. Off, 1. On)
data[].attributes[].answerStringRich text answer
data[].attributes[].srcTypeIntegerSource type (0. Customized, 1. Inherit template attribute value)

Example

curl 'http://www.udesk.cn/v1/datums?email=admin@udesk.cn&timestamp=1573024943&sign=b5236e4bc2e73e529d544ace070f8c31369ca9dd' -i -X PUT -H 'Content-Type: application/json' -d '{
    "name":"Create New Knowledge",
    "robotId":83,
    "templateId":56,
    "categoryId":23
}'
  
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "data": {
        "id": 3,
        "name": "Udesk Test Knowledge",
        "similarList": [],
        "robotId": 83,
        "templateId": 56,
        "templateName": "Udesk Test Template",
        "categoryId": 23,
        "orders": 1,
        "category": 23,
        "attributes": [
            {
                "id": 1,
                "name": "Complaints and Suggestions",
                "robotId": 83,
                "datumId": 3,
                "templateId": 56,
                "templateAttributeId": 33,
                "switchStatus": null,
                "answer": null,
                "srcType": null
            },
            {
                "id": 2,
                "name": "Template Attribute 2",
                "robotId": 83,
                "datumId": 3,
                "templateId": 56,
                "templateAttributeId": 135,
                "switchStatus": null,
                "answer": "<p>Template Attribute 2 Value</p>",
                "srcType": 1
            }
        ]
    }
}

Request Failure Reasons

{
  "code": 400,
  "message": "{Specific Exception Information}",
  "visible": false
}
messagedescription
"Data has been deleted or does not exist"The knowledge point corresponding to the ID does not exist

Update Knowledge Interface

Request Address

  • PUT /v1/datums/:id

Request Parameters

Request fields

PathTypeOptionalDescription
robotIdIntegerfalseRobot ID
nameStringfalseKnowledge Name
displayNameStringfalseKnowledge Display Name
templateIdIntegerfalseTemplate ID
templateNameStringfalseTemplate Name
similarList[]StringtrueSynonyms
categoryIdIntegerfalseCategory ID
ordersIntegerfalseSort ID
attributesArraytrueKnowledge attribute values (Knowledge attribute values can only be modified, not added or deleted, obtained through knowledge details)
attributes[].idIntegerfalseID
attributes[].nameStringfalseAttribute Name
attributes[].robotIdIntegerfalseRobot ID
attributes[].datumIdIntegerfalseKnowledge ID
attributes[].templateIdIntegerfalseTemplate ID
attributes[].templateAttributeIdIntegerfalseTemplate Attribute ID
attributes[].switchStatusIntegerfalseWhether it is open (0. Off, 1. On)
attributes[].answerStringtrueRich text answer
attributes[].srcTypeIntegerfalseSource type (0. Customized, 1. Inherit template attribute value) (If the attribute has no default value or is different from the default value of the attribute, srcType is 0)

Request Result

PathTypeDescription
codeIntegerStatus code
messageStringReturn message
dataObjectReturn content

Example

$ curl 'https://km.udesk.cn/api/v1/datums/3?email=admin@udesk.cn&timestamp=1559022283&sign=aa8164470dff8468e6129c1e7d5767651cdedd7c' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
            "id": 3,
            "name": "Updated New Knowledge",
            "similarList": [],
            "robotId": 83,
            "templateId": 56,
            "templateName": null,
            "categoryId": 23,
            "orders": null,
            "category": null,
            "attributes": [
                {
                    "id": 1,
                    "name": "Complaints and Suggestions",
                    "robotId": 83,
                    "datumId": 3,
                    "templateId": 56,
                    "templateAttributeId": 33,
                    "switchStatus": null,
                    "answer": null,
                    "srcType": null
                },
                {
                    "id": 2,
                    "name": "Template Attribute 2",
                    "robotId": 83,
                    "datumId": 3,
                    "templateId": 56,
                    "templateAttributeId": 135,
                    "switchStatus": null,
                    "answer": "<p>Template Attribute 2 Value</p>",
                    "srcType": 1
                }
            ]
        }'
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "data": {
        "id": 3,
        "name": "Updated New Knowledge",
        "similarList": [],
        "robotId": 83,
        "templateId": 56,
        "templateName": null,
        "categoryId": 23,
        "orders": null,
        "category": null,
        "attributes": [
                {
                    "id": 1,
                    "name": "Complaints and Suggestions",
                    "robotId": 83,
                    "datumId": 3,
                    "templateId": 56,
                    "templateAttributeId": 33,
                    "switchStatus": null,
                    "answer": null,
                    "srcType": null
                },
                {
                    "id": 2,
                    "name": "Template Attribute 2",
                    "robotId": 83,
                    "datumId": 3,
                    "templateId": 56,
                    "templateAttributeId": 135,
                    "switchStatus": null,
                    "answer": "<p>Template Attribute 2 Value</p>",
                    "srcType": 1
                }
            ]
    }
}

Get Category List Interface

Request Address

  • POST /v1/datumCategories/search

Request Parameters

Request fields

PathTypeOptionalDescription
pageNumIntegertruePage number
pageSizeIntegertrueNumber of items per page
robotIdIntegerfalseRobot ID
keywordStringtrueKeyword search

Request Result

PathTypeDescription
codeIntegerExecution result code
messageStringExecution result explanation
dataObjectCategory information
data[].idIntegerCategory ID
data[].nameStringCategory Name
data[].robotIdIntegerRobot ID
data[].parentIdIntegerParent Category ID

Example

$ curl 'https://km.udesk.cn/api/v1/datumCategories/search?email=admin@udesk.cn&timestamp=1578367614&sign=5548fd5ad06564b64f6925aeed99ec937d17f444' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
    "pageNum":1,
    "pageSize":10,
    "robotId":83,
    "keyword":"a"
}'
  
Response
{
    "code": 200,
    "message": "OK",
    "visible": false,
    "paging": {
        "pageNum": 1,
        "pageSize": 10,
        "total": 1
    },
    "data": [
        {
            "id": 26,
            "name": "ablity",
            "robotId": 83,
            "parentId": 9
        }
    ]
}