API Call Instructions
# API Call Instructions
# Call Declaration
● Before using the Sobot Open API, you must apply for an appid and app_key from Sobot's business or after-sales personnel and confirm the corresponding environment. Subsequent API calls must use the domain name corresponding to that environment (Singapore: sg.sobot.io, North American: us.sobot.com, except for voice-related APIs).
● When calling an interface, you must include the "token" parameter in the header of the HTTPS request.
Token is the globally unique credential for accessing the Sobot Customer Service Open Platform API. Developers need to use this Token when calling various business interfaces and must store it securely. The storage for Token should reserve at least 32 characters. The current validity period of a Token is 24 hours. It needs to be refreshed periodically, or re-obtained based on Token expiration prompts returned by the interface. Calling the Token request interface will always return a new Token and reset its expiration time (currently 24 hours), regardless of whether a Token already exists.
Token Usage Instructions:
- Developers need to centrally obtain and manage the Token. The same Token should be used when calling various business open interfaces of Sobot Customer Service. It is not recommended to refresh and obtain a new Token for each business, as this may easily cause Token invalidation and affect normal interface calls.
- The current Token validity period is communicated via the returned
expires_invalue, currently within 86,400 seconds. Developers need to refresh the Token in advance based on this validity period. - Developers need to re-obtain the Token based on Token invalidation prompts returned by the interface.
# Get the Access Token Code
Interface Description:
Obtain the API Open Interface Token. This Token is only applicable to all API interfaces of Sobot Open Platform version 5.0.
Request Method:
GET
Request URL:
/api/get_token
Request Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| appid | String | Yes | The unique credential ID for third-party user interface calls. |
| create_time | String | Yes | Timestamp (in seconds), e.g., the timestamp for 2019-09-25 15:49:33 is 1569397773. |
| sign | String | Yes | Signature, calculated as md5(appid + create_time + app_key). app_key is the secret key. |
Request Example:
curl https://${domain}/api/get_token?appid=1&create_time=1569397773&sign=258eec3118705112b2c53dc8043d4d34
Response Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| ret_code | String | Yes | Return Code |
| ret_msg | String | Yes | Return Message |
| item | Object | No | Return Object |
item Object:
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Token |
| expires_in | String | Yes | Token validity period |
Timestamp Conversion Reference Tool:
http://tool.chinaz.com/Tools/unixtime.aspx
sign Signature Generation Example:
For example, appid = "1"; create_time="1569397773"; app_key="2"
sign = Md5("115693977732") results in 258eec3118705112b2c53dc8043d4d34.
Response Example:
{
"item": {
"token": "4ac37cb2e9c740dba4b75a34d5358802",
"expires_in": "86400"
},
"ret_code": "000000",
"ret_msg": "Success"
}
2
3
4
5
6
7
8
# API return code
# ● Operation Done
| Return code | Code description |
|---|---|
| 000000 | Operation done (Any code other than this code is an error code) |
# ● System Exception
| Return code | Code description |
|---|---|
| 700046 | The current company's purchased version does not support using the interface (Free Edition, Overseas Team Edition cannot use it). |
| 900001 | Token is empty. |
| 900002 | Token has expired, please obtain a new one. |
| 900003 | Signature error. |
| 900004 | No API configuration information found for the company. |
| 999999 | System unknown exception. |
- 01
- CallCapability(Android-SDK)06-29
- 02
- Message Compliance Inspection API05-28
- 03
- Android SDK V710-22