Knowledge Base V6 API
# Knowledge Base V6
# API Declaration
The "token" param must be contained in the header of the https request when calling the API.
Token is the only global API call credential for the Sobot API open platform. It is used when developers call the business APIs and thus should be properly kept. At least 32 chars should be reserved to store token. The validity period of token is currently 24 hours. It needs to be refreshed regularly or reacquired according to the token failure prompt returned by the API. When requesting the token API, regardless of the existence of token, a new token will be returned and its expiry time will be reset (currently 24 hours).
Token usage description: 1. Developers need to obtain and manage the token uniformly. When calling the Sobot open APIs of various businesses, they should use the same token, instead of refreshing and obtaining new tokens for each business. Otherwise, it will easily lead to token invalidation and affect the normal API call. 2. The current validity period of the token is transmitted by the returned expire_in, which is currently a value within 86,400 seconds. Developers need to refresh the new token in advance based on this valid time. 3. Developers should reacquire the token according to the token invalidation prompt returned by the API.
# API Call
# ● Get the Access Token Code
API description:
Get the open API token, which is only applicable to all APIs of Sobot Open Platform v5.0. Contact the Sobot after-sales service personnel to get appid and app_key in the API.
Request method:
GET
Request URL:
https://sg.sobot.io/api/get_token
Request param:
Param | Type | Required | Description |
---|---|---|---|
appid | String | Yes | API credential ID, the unique API call credential ID for the 3rd-party users |
create_time | String | Yes | 10-digit timestamp |
sign | String | Yes | Signature md5(appid+create_time+app_key) |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
Item object:
Param | Type | Required | Description |
---|---|---|---|
token | String | Yes | Token code |
expires_in | String | Yes | Credential valid time (unit: s) |
Timestamp conversion tool:
http://tool.chinaz.com/Tools/unixtime.aspx
Sign signature generation example:
E.g., appid = "1"; create_time="1569397773"; app_key="2"
Sign = Md5("115693977732") is 258eec3118705112b2c53dc8043d4d34.
Request example:
curl https://sg.sobot.io/api/get_token?appid=1&create_time=1569397773&sign=258eec3118705112b2c53dc8043d4d34
Return example:
{
"item": {
"token": "4ac37cb2e9c740dba4b75a34d5358802",
"expires_in": "86400"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# ● Query entry list of the knowledge base
API description:
API type: Active call API
API function: Query the list of all knowledge entries in a certain knowledge base by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/search_doc_list
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
key_flag | String | Yes | 1 Standardized question, 3 Answer |
question_typeid | String | Yes | Entry type (pass-1) |
kbids | List | Yes | Affiliated Knowledge Base Int Type Set |
page_no | String | Yes | Current page |
page_size | String | Yes | Page Number |
key_words | List | No | Search Keyword String Type Set |
used_flag | String | No | Entry status, 0 - Enable, 1 - Manually disable, 2 - System disable, 3 - Disable by expiration |
link_flag | String | No | Is there any associated question, 0 - Yes, 1 - No |
createid | String | No | Entry creator ID |
create_start_date | String | No | Creation start date |
create_end_date | String | No | Creation end date |
updateid | String | No | Entry latest operator |
update_start_date | String | No | Update start date |
update_end_date | String | No | Update end date |
effect_start_date | String | No | Valid start date |
effect_end_date | String | No | Valid end date |
invalid_start_date | String | No | Invalid start date |
invalid_end_date | String | No | Invalid end date |
is_draft | String | No | Is it a draft 0 - No 1 - Yes Blank - All |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Return code | |
ret_msg | String | Return message | |
items | Object | Return object | |
page_count | String | Total pages | |
page_no | String | Current page | |
page_size | String | Pieces on each page | |
total_count | String | Total pieces |
Items object:
Param | Type | Required | Description |
---|---|---|---|
audit_status | String | Approval status: 0 - To be approved, 1 - Permanently valid, 2 - Valid at designated time | |
companyid | String | Company ID | |
docid | String | Entry ID | |
questionid | String | Question ID | |
effect_time | String | Valid Time | |
create_time | String | Creation Time | |
invalid_time | String | Invalid Time | |
link_flag | String | Is there any associated question, 0 - Yes, 1 - No | |
match_flag | String | Match mode: 0-Intelligent match, 1-Exact match, 2-Containing match, 3-Greeting match | |
questionid | String | Question ID | |
question_title | String | Question title | |
question_typeid | String | Question type ID | |
question_type_name | String | Question type name | |
kbid | String | Affiliated bot of knowledge base: 0 - Public knowledge base, 1 - Bot— | |
smail_question_num | String | Similar question no. | |
updateid | String | Operator ID | |
update_time | String | Update Time | |
used_flag | String | Entry status, 0 - Enable, 1 - Manually disable, 2 - System disable, 3 - Disable by expiration, -2: Hide status | |
answer_list | List | Answer |
answer_list object:
Param | Type | Required | Description |
---|---|---|---|
answerid | String | Answer ID | |
answer_desc | String | Answer Content | |
answer_img | String | Thumbnail | |
answer_summary | String | Digest | |
answer_txt | String | Plain text info of answer | |
file_size | String | File size | |
msg_type | String | Answer type: -1 Rich text 7 Mini Program |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/search_doc_list
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"key_words":["search"],
"key_flag":1,
"page_no": "1",
"page_size": "15"
}'
2
3
4
5
6
7
8
9
10
11
Return example:
{
"total_count": 2,
"page_no": 1,
"ret_msg": "success",
"ret_code": "000000",
"items": [
{
"kbid": 39,
"match_flag": 0,
"linked_list": [],
"docid": "5bb788ee7a0a4f3aa42494bd85a63925",
"link_question_list": [],
"rule_list": [
{
"rule_answer_list": []
}
],
"audit_status": 1,
"smail_question_list": [],
"question_title": "title",
"question_typeid": "dd92ec4c6ba2411bb316c972d6bdbdf6",
"is_experience": 0,
"smail_question_num": 0,
"update_time": "2022-07-29 19:57:06",
"answer_type": 1,
"answer_list": [
{
"msg_flag": 0,
"answer_desc": "<p>answer</p>",
"msg_type": -1,
"answer_txt": "answer",
"answer_summary": "answer"
}
],
"question_type_name": "type",
"invalid_time": "2099-12-31 23:59:59",
"update_service_name": "baimingdan",
"used_flag": 0,
"effect_time": "2022-07-29 00:00:00"
},
{
"kbid": 39,
"match_flag": 0,
"linked_list": [],
"docid": "493733a7228146159baa7a35834d218d",
"link_question_list": [],
"rule_list": [
{
"rule_answer_list": []
}
],
"audit_status": 1,
"smail_question_list": [],
"question_title": "title",
"question_typeid": "dd92ec4c6ba2411bb316c972d6bdbdf6",
"is_experience": 0,
"smail_question_num": 0,
"update_time": "2022-07-29 20:01:47",
"answer_type": 1,
"answer_list": [
{
"msg_flag": 0,
"answer_desc": "<p>answer</p>",
"msg_type": -1,
"answer_txt": "answer",
"answer_summary": "answer"
}
],
"question_type_name": "type",
"invalid_time": "2099-12-31 23:59:59",
"update_service_name": "baimingdan",
"used_flag": 0,
"effect_time": "2022-07-29 00:00:00"
}
],
"page_count": 1,
"page_size": 10
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# ● Query knowledge base category list
API description:
API type: Active call API
API function: Query the category of a knowledge base by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/get_kb_list
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
robot_flag | String | Yes | Affiliated bot of knowledge base: 1 - Bot— |
kbid | String | No | Knowledge Base ID |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
items | Object | No | Return object |
Items object:
Param | Type | Required | Description |
---|---|---|---|
id | String | type=1 Knowledge Base ID type=2 Question Category ID | |
kbid | String | Knowledge Base ID | |
name | String | Knowledge Base Name | |
type | String | 1 Knowledge Base, 2 Question Category | |
parent_typeid | String | Parent category ID | |
question_type_desc | String | Question Category Description | |
question_typeid | String | Question Category ID | |
question_type_name | String | Question Category Name | |
child_type_list | List | Sub-level, same as the structure of parent level |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/get_kb_list
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"robot_flag":"1"
}'
2
3
4
5
6
7
8
Return example:
{
"ret_msg": "success",
"ret_code": "000000",
"items": [
{
"kbid": 10,
"name": "kb",
"child_type_list": [
{
"question_type_desc": "one",
"question_type_name": "333",
"name": "333",
"parent_typeid": "-1",
"child_type_list": [],
"id": "cbf5d929019b4e3fb50dc06ff9a36b29",
"type": 2,
"question_typeid": "cbf5d929019b4e3fb50dc06ff9a36b29"
},
{
"question_type_desc": "one",
"question_type_name": "213",
"name": "213",
"parent_typeid": "-1",
"child_type_list": [],
"id": "b33bd779f8fc44c6aa98fe79d464115f",
"type": 2,
"question_typeid": "b33bd779f8fc44c6aa98fe79d464115f"
},
{
"question_type_desc": "one",
"question_type_name": "type",
"name": "type",
"parent_typeid": "-1",
"child_type_list": [
{
"question_type_desc": "two",
"question_type_name": "2212",
"name": "2212",
"parent_typeid": "536f9e5794c340f39f7e2e2567117780",
"child_type_list": [],
"id": "26daee4e54b045e0a0ebf5f97c5a179a",
"type": 2,
"question_typeid": "26daee4e54b045e0a0ebf5f97c5a179a"
}
],
"id": "536f9e5794c340f39f7e2e2567117780",
"type": 2,
"question_typeid": "536f9e5794c340f39f7e2e2567117780"
}
],
"id": "79307a3786c94313b14196fa096f4845",
"type": 1
},
{
"kbid": 36,
"name": "kb36",
"child_type_list": [],
"id": "48ac199888c04a7f92d5db1990214c0e",
"type": 1
},
{
"kbid": 39,
"name": "kb39",
"child_type_list": [
{
"question_type_desc": "one",
"question_type_name": "name",
"name": "name",
"parent_typeid": "-1",
"child_type_list": [
{
"question_type_desc": "two",
"question_type_name": "name",
"name": "name",
"parent_typeid": "dd92ec4c6ba2411bb316c972d6bdbdf6",
"child_type_list": [],
"id": "c186ae1deffd43d1b26ffe793e4eb569",
"type": 2,
"question_typeid": "c186ae1deffd43d1b26ffe793e4eb569"
}
],
"id": "dd92ec4c6ba2411bb316c972d6bdbdf6",
"type": 2,
"question_typeid": "dd92ec4c6ba2411bb316c972d6bdbdf6"
}
],
"id": "ee736f20c7b24aa0aefe17888dd0e592",
"type": 1
},
{
"kbid": 41,
"name": "kb41",
"child_type_list": [
{
"question_type_desc": "one",
"question_type_name": "12121211212",
"name": "12121211212",
"parent_typeid": "-1",
"child_type_list": [],
"id": "5572ede5bec348fc951f80f8ab0967c9",
"type": 2,
"question_typeid": "5572ede5bec348fc951f80f8ab0967c9"
}
],
"id": "f9532c3c2ed34e9fb8d5781b692ff3ba",
"type": 1
},
{
"kbid": 43,
"name": "genglu43",
"child_type_list": [],
"id": "94abc19b81134afdbe212f8fa7978cc1",
"type": 1
},
{
"kbid": 44,
"name": "kb445",
"child_type_list": [],
"id": "0d871b87ed1b4de7b1cb83923b96b021",
"type": 1
},
{
"kbid": 45,
"name": "kb56",
"child_type_list": [
{
"question_type_desc": "one",
"question_type_name": "name",
"name": "name",
"parent_typeid": "-1",
"child_type_list": [],
"id": "8589d0dde56b47038bf8bd92da8e89a1",
"type": 2,
"question_typeid": "8589d0dde56b47038bf8bd92da8e89a1"
}
],
"id": "37246310bcb94791bc67eb4d0e980d60",
"type": 1
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# ● Query knowledge base entries
API description:
API type: Active call API
API function: Query the details of a knowledge entry by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/doc_info
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
docid | String | Yes | Entry ID |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
Item object:
Param | Type | Required | Description |
---|---|---|---|
audit_status | String | Approval status: 0 - To be approved, 1 - Permanently valid, 2 - Valid at designated time | |
companyid | String | Company ID | |
docid | String | Entry ID | |
effect_time | String | Valid Time | |
invalid_time | String | Invalid Time | |
link_flag | String | Is there any associated question, 0 - Yes, 1 - No | |
match_flag | String | Match mode: 0-Intelligent match, 1-Exact match, 2-Containing match, 3-Greeting match | |
questionid | String | Question ID | |
question_title | String | Question title | |
question_typeid | String | Question type ID | |
question_type_name | String | Question type name | |
kbid | String | Affiliated bot of knowledge base: 0 - Public knowledge base, 1 - Bot— | |
smail_question_num | String | Similar question no. | |
update_service_name | String | Operator | |
update_time | String | Update Time | |
used_flag | String | Entry status, 0 - Enable, 1 - Manually disable, 2 - System disable, 3 - Disable by expiration, -2: Hide status | |
answer_list | List | Answer | |
link_question_list | List | Associated Question | |
smail_question_list | List | Similar Question String Type Set |
answer_list object:
Param | Type | Required | Description |
---|---|---|---|
answerid | String | Answer ID | |
answer_desc | String | Answer Content | |
answer_img | String | Thumbnail | |
answer_summary | String | Digest | |
answer_txt | String | Plain text info of answer | |
file_size | String | File size | |
msg_type | String | Answer type: -1 Rich text 7 Mini Program |
link_question_list object:
Param | Type | Required | Description |
---|---|---|---|
docid | String | Associated Question Entry ID | |
link_name | String | Associated Question Name | |
link_question_title | String | Standardized question of associated entry |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/doc_info
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"docid":"7ec94257f97b42fa8ebab7839b960b9e"
}'
2
3
4
5
6
7
8
Return example:
{
"item": {
"kbid": 10,
"match_flag": 0,
"linked_list": [],
"docid": "7ec94257f97b42fa8ebab7839b960b9e",
"link_question_list": [],
"rule_list": [
{
"rule_answer_list": []
}
],
"audit_status": 1,
"smail_question_list": [],
"question_title": "title",
"question_typeid": "cbf5d929019b4e3fb50dc06ff9a36b29",
"m_linked_list": [],
"smail_question_num": 0,
"update_time": "2022-08-29 16:11:07",
"answer_type": 1,
"answer_list": [
{
"msg_flag": 0,
"answer_desc": "<p>answer</p><p></p><div class=\"media-wrap image-wrap\"><img class=\"media-wrap image-wrap\" src=\"https://sobot-test.oss-cn-beijing.aliyuncs.com/console/624f6b0bdcad4559bba55758b851f2e8/common/2b59f77d3cb1701e94e74816ca999a58_1661759493840.jpg\"/></div>",
"msg_type": -1,
"answer_txt": "answer",
"answer_summary": "answer"
},
{
"msg_flag": 0,
"answer_desc": "<p><br></p><p><img src=\"https://sobot-test.oss-cn-beijing.aliyuncs.com/console/624f6b0bdcad4559bba55758b851f2e8/common/_1661760663750.png\" alt=\"\" data-href=\"\" style=\"\"/></p>",
"msg_type": -1,
"answer_txt": "",
"answer_summary": "a"
},
{
"msg_flag": 0,
"answer_desc": {
"cover_url": "https://img.sobot.io/kb-center-service/discovery/624f6b0bdcad4559bba55758b851f2e8/2022-08-29/09802e950869450ebc3a1c43696ac197.jpg",
"id": "chewud",
"page": "dhiuewhnde.html",
"title": "cbsjdkne"
},
"msg_type": 7
}
],
"question_type_name": "333",
"invalid_time": "2099-12-31 23:59:59",
"update_service_name": "baimingdan",
"used_flag": 0,
"effect_time": "2022-08-29 00:00:00"
},
"ret_msg": "success",
"ret_code": "000000",
"items": []
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# ● Query similar question
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/query_doc_similar_list
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
kbids | List | Yes | Affiliated Knowledge Base Int Type Set |
key_words | List | No | Search Keyword String Type Set |
page_no | Integer | Yes | Current page |
page_size | Integer | Yes | Page Number |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
page_no | Integer | Yes | Page |
page_count | Integer | Yes | Pages |
total_count | String | Yes | Total |
page_size | String | Yes | Page size |
items | Object | No | Return object |
Items object
Param | Type | Required | Description |
---|---|---|---|
docid | String | Entry ID | |
quection_title | String | Question title | |
questionid | String | Question ID | |
create_serviceid | String | Creator ID | |
create_service_name | String | Creator name | |
create_time | Long | Creation Time | |
update_serviceid | String | Updater ID | |
update_service_name | String | Updater name | |
update_time | Long | Update time | |
kbid | Integer | Affiliated Knowledge Base |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/query_doc_similar_list
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"key_words":[],
"kbids":[],
"page_no": "1",
"page_size": "15"
}'
2
3
4
5
6
7
8
9
10
11
Return example:
{
"total_count": 68,
"page_no": 1,
"ret_msg": "success",
"ret_code": "000000",
"items": [
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-19 18:43:12",
"questionid": "b6697093312a41989f774fa14c6841a0",
"create_time": "2022-08-19 18:43:12",
"docid": "177bccd41ba0406180e438c20e90a3c2",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "name",
"create_service_name": "name",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "124efd04fab0406fb8eccb39ff52194d",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "titel",
"update_service_name": "name",
"create_service_name": "name",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "54e2f046544a447fba454cae1f6a0bfd",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "name",
"create_service_name": "name",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "59cf884d2dc945aab08bb70b4d2f5482",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "aa2096d2bd204434818483d3540eff78",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "ac5c48d659ee460fbeeb22696d97dafe",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title"
},
{
"kbid": 39,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-26 00:48:01",
"questionid": "faac54f8417d420d802cae7da1c2766e",
"create_time": "2022-08-26 00:48:01",
"docid": "a3eccfbd47f4464db60b552bf1abc6c1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title?",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title?"
},
{
"kbid": 41,
"update_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": "2022-08-17 20:48:41",
"questionid": "3aa3309d30cb48199937637668e43b20",
"create_time": "2022-08-17 20:48:41",
"docid": "000c2f46e88f447484b9f4b0b01dbcd1",
"create_serviceid": "76b5a705f2254ed3b1a356e2b50cef70",
"sim_question_title": "title",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title"
},
{
"kbid": 32,
"update_serviceid": "b51be009d492428395879ce8c1c23313",
"update_time": "2022-07-23 14:47:20",
"questionid": "84307f62b02b4b85b563397427f01942",
"create_time": "2022-07-23 14:47:20",
"docid": "70f0cb497a4e44fb8cab2c712682e8e7",
"create_serviceid": "b51be009d492428395879ce8c1c23313",
"sim_question_title": "title",
"update_service_name": "baimingdan",
"create_service_name": "baimingdan",
"question_title": "title"
},
{
"kbid": 1,
"update_serviceid": "cddc7690ffe44b719e2383f70ea62349",
"update_time": "2022-07-21 14:28:20",
"questionid": "7bf2438f1a4d4427b166d3390c773bca",
"create_time": "2022-07-21 14:28:20",
"docid": "397000a8c6604434aee8d5269db389be",
"create_serviceid": "cddc7690ffe44b719e2383f70ea62349",
"sim_question_title": "title",
"update_service_name": "title",
"create_service_name": "title",
"question_title": "title"
}
],
"page_count": 7,
"page_size": 10
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# ● Add knowledge base entries
API description:
API type: Active call API
API function: Add a knowledge entry by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/add_robot_doc
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
kbid | String | Yes | Knowledge Base ID |
question_title | String | Yes | Standardized Question |
match_flag | String | Yes | Match mode: 0 - Intelligent match, 1 - Exact match, 2 - Containing match |
question_typeid | String | Yes | Entry category ID |
used_flag | String | Yes | Entry status: 0 - Enable, 1 - Disable |
audit_status | String | Yes | Valid status: 1 - Permanently valid; 2 - Valid at designated time |
effect_time | String | No | Valid time, format: yyyy-MM-dd HH:mm:ss |
invalid_time | String | No | Invalid time, format: yyyy-MM-dd HH:mm:ss |
answer_list | List | Yes | Answer array |
answer_list object:
Param | Type | Required | Description |
---|---|---|---|
answer_desc | String | Answer content, html rich text | |
msg_type | String | Answer type: -1 Rich text |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | Yes | Entry |
Item object:
Param | Type | Required | Description |
---|---|---|---|
docid | String | Yes | Entry ID |
companyid | String | Yes | Company ID |
used_flag | String | Yes | Entry status |
kbid | Integer | Yes | Knowledge Base ID |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/add_robot_doc
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"kbid": 10,
"match_flag": "0",
"audit_status": "1",
"question_title": "open11111",
"question_typeid": "cbf5d929019b4e3fb50dc06ff9a36b29",
"answer_list": [{
"answer_desc": "<p>open11111</p>",
"msg_type": -1
}],
"invalid_time": "2022-08-29 23:59:59",
"used_flag": "0",
"effect_time": "2022-08-29 00:00:00"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Return example:
{
"item": {
"kbid": 10,
"match_flag": 0,
"create_time": 1661764052,
"docid": "bc114dad4e954ca4a7e49a14915f0170",
"audit_status": 1,
"question_typeid": "cbf5d929019b4e3fb50dc06ff9a36b29",
"updateid": "76b5a705f2254ed3b1a356e2b50cef70",
"update_time": 1661764052,
"companyid": "624f6b0bdcad4559bba55758b851f2e8",
"createid": "76b5a705f2254ed3b1a356e2b50cef70",
"link_flag": 1,
"invalid_time": 4102415999,
"used_flag": 0,
"effective_scope": "0",
"effect_time": 1661702400
},
"ret_msg": "success",
"ret_code": "000000",
"items": []
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ● Modify knowledge base entries
API description:
API type: Active call API
API function: Modify a knowledge entry by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/update_robot_doc
Request param:
Param | Type | Required | Description |
---|---|---|---|
docid | String | Yes | Entry ID |
kbid | String | Yes | Knowledge Base ID |
question_title | String | Yes | Standardized Question |
match_flag | String | Yes | Match mode: 0 - Intelligent match, 1 - Exact match, 2 - Containing match |
question_typeid | String | Yes | Entry category ID |
used_flag | String | Yes | Entry status: 0 - Enable, 1 - Disable |
audit_status | String | Yes | Valid status: 1 - Permanently valid; 2 - Valid at designated time |
effect_time | String | No | Valid time, format: yyyy-MM-dd HH:mm:ss |
invalid_time | String | No | Invalid time, format: yyyy-MM-dd HH:mm:ss |
answer_list | List | Yes | Answer array |
answer_list object:
Param | Type | Required | Description |
---|---|---|---|
answer_desc | String | Answer content, html rich text | |
msg_type | String | Answer type: -1 Rich text |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/update_robot_doc
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-d '{
"kbid": 10,
"docid": "bc114dad4e954ca4a7e49a14915f0170",
"match_flag": "0",
"audit_status": "1",
"question_title": "open11111",
"question_typeid": "cbf5d929019b4e3fb50dc06ff9a36b29",
"answer_list": [{
"answer_desc": "<p>open222sss2</p>",
"msg_type": -1
}],
"invalid_time": "2022-08-29 23:59:59",
"used_flag": "0",
"effect_time": "2022-08-29 00:00:00"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Return example:
{
"ret_msg": "success",
"ret_code": "000000",
"items": []
}
2
3
4
5
# ● Delete knowledge base entries
API description:
API type: Active call API
API function: Delete a knowledge entry in the knowledge base by calling the API
Request method:
POST
Request URL:
https://sg.sobot.io/open/robot/v6/new_single/delete_doc
Request header:
Param | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag: en - English, zh - Chinese (Chinese by default) |
Request param:
Param | Type | Required | Description |
---|---|---|---|
docid_list | List | Yes | Entry ID Set String Type Set |
kbid | String | Yes | Affiliated Knowledge Base |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
Request example:
curl https://sg.sobot.io/open/robot/v6/new_single/delete_doc
-X POST
-H 'token: xxxxxxxxxxxxxxxxxxxxxxxxx'
-H 'Content-Type: application/json'
-H 'language: en'
-d '{
"docid_list":["bc114dad4e954ca4a7e49a14915f0170"],
"kbid":10
}'
2
3
4
5
6
7
8
9
Return example:
{
"ret_msg": "success",
"ret_code": "000000",
"items": []
}
2
3
4
5
# Error code
# ● Operation Done
Error code | Error description |
---|---|
000000 | Operation done (Any code other than this code is an error code) |
# ● System Exception
Error code | Error description |
---|---|
999999 | Unknown System Exception |
401 | Token expired |
# ● Business Exception
Error code | Error description |
---|---|
400016 | Param error |
400002 | Addition failed, standardized question or similar question repeated! |
400136 | Wrong time format |
400057 | Entry enabling failed, enterprise data access error! |
400006 | Entries are over limit! |
400022 | Answer is too long! |
400026 | Entry cannot be blank! |
400012 | Operation entry not found! |
402008 | Knowledge base ID cannot be blank |
402009 | Entry not found or deleted |
400001 | Question title cannot be blank |
400027 | Category cannot be blank |
402010 | Category ID not found or invalid in the current knowledge base |