Get Access Credentials
API Description
Use this API to request an API access credential, or token, from the metric platform. The token allows a client to call related service resources for a limited validity period. If no validity period is specified, the token is valid for 6 hours by default and expires automatically afterward.
API URL
POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/token/create
For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.
Request Parameters
Common Request Parameters (HEADERS)
None

Request Parameters
| Parameter | Type | Required | Description | |
|---|---|---|---|---|
| appId | String | Yes | API Key ID from the user's personal center. | |
| appSecret | String | Yes | API Key Secret from the user's personal center. | |
| expire | int | No | Expiration time in seconds. For example, 3600 means the token expires after 1 hour. |
Response Parameters
Response Parameter Description
| Parameter | Type | Required | Description | |
|---|---|---|---|---|
| code | String | Yes | API response code. | |
| success | Boolean | Yes | Whether the request succeeded. | |
| errorMsg | String | Yes | Error message. | |
| detailErrorMsg | String | Yes | Detailed error message. | |
| traceId | String | Yes | Trace ID. | |
| data | array | Yes | Returned token value. |
Request Example
{
"appId": "03b34c53d4864da0995ecbcdbcf9ca65",
"appSecret": "8K7BLJm0ZmzxtU7vfqF1ts5EO30WJMNQ",
"expire": 3600
}