API description
Keynote Tingyun Web provides an HTTP interface to directly obtain the chart data in the report, and then import its own database or realize its own report customization and integration.
Reference Standard
JSON (JavaScriptObjectNotation): http://www.json.org/
HTTP protocol: http://www.w3.org/Protocols/rfc2616/rfc2616.html.
Data format
The API supports the JSON data format.
Interface specification
Language (Locale)
The default language is Simplified Chinese (zh_CN). If you need to specify other languages, specify them in the request header:
Accept-Language: xxxx
Supported languages include:
*zh_CN *en_US
- En (case insensitive)
Error and exception handling
Errors and exceptions are returned through response status codes and response headers.
Response status code:
- 403-Invalid authorization code or invalid API version number.
- 404-The requested content (account, application, server, etc.) does not exist.
- 400-Invalid request. For example, the request for the chart API should be xxxx/charts/
{chart_ID}
.json. When the user requests xxxx/chart/{chart_ID}
.json (an s is missing from charts), Or xxxx/charts/{chart_ID}
.csv (CSV format is not supported), 400 is returned. - 430-Invalid query parameter.
- 530 – Server side error.
Corresponding to the above status codes, except that 530 server-side errors may not give friendly prompts, other errors shall be marked with prompt error descriptions in the response header:
Error-Message: xxxxxxx
The error description does not need to adapt to multiple languages and is a concise English prompt (most API clients are programs or automated scripts, and the error description is usually used for log output, and the English output is more friendly to operation and maintenance) . The standard error prompt is as follows:
403 – Invalid auth key “{auth_key}”
Invalid API version “{api_version}”
404 – Account #{account_id} not found
Application #{mobileApplicationId} not found
Server #{server_id} not found
400 – Bad request of resource “{request_res}”
Bad request of resource “{res_id}”
Bad request of format “{format_ext}”
430 – Invalid parameter {param_name}: “{param_value}”, {validation_error_message}
Preparations
Before obtaining the chart data in the report, you need to obtain the access _ token of the Wukong platform for identity authentication.
Interface call address:
${host}/auth-api/auth/token?api_key=xxxxx&auth=xxxxx×tamp=xxxxxx
Request parameter description:
Field name | Type | Description |
---|---|---|
api_key | String | Identity check code |
auth | String | Cryptographic signature |
timestamp | Long | Millisecond timestamp for the current request |
Return example:
{
"code": 200,
"msg": "success",
"access_token": "hbWUiOiLkupHljZfnlLXnvZEiLCJjb"
}
Return parameter description:
Parameter name | Description |
---|---|
code | Return code |
msg | Return message |
access_token | Used for identity authentication when calling the tone listening cloud API |
Return code description:
code | msg | description |
---|---|---|
200 | success | success |
40001 | Invalid timestamp | Invalid timestamp |
40002 | Invalid api_key | Invalid api_key |
40003 | Invalid auth | Invalid signature |
To call the cloud API to obtain data, you need to add the Authorization parameter in the Headers of the request. The parameter value is "Bearer" + ${access_token}
.
Authorization Example:
Authorization= Bearer hbWUiOiLkupHljZfnlLXnvZEiLCJjb
Notice: There is a space between Bearer and access_token.