Get Access Token
Access Token is used to verify an authenticated API call. The third-party application needs to request for an access token and carry the access token in every request to access the API.
Restriction
Each third-party application is limited to 8 valid access tokens simultaneously.
Note: Once the limit is reached, a new token can only be obtained after an existing token expires (30-minute) or is actively revoked.
Prerequisites
You have enabled the API feature on the Cloud One BCS. For more information, see Enable Cloud One Business Communication Suite API.
Request URL
POST {base_url}/{api_path}/get_token
Request Parameters
Important: You MUST include a User-Agent header with every request that you submit to the Cloud One BCS API, so that the PBX can identify your application and respond to the request. For example, User-Agent: OpenAPI.
| Parameter | Required | Type | Description |
|---|---|---|---|
| username | Yes | String | User name. You can obtain the username from the Client ID on PBX web portal. |
| password | Yes | String | Password. You can obtain the password from the Client Secret on PBX web portal. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
|
| errmsg | String | Returned message.
|
| access_token_expire_time | Integer | Access token expire time. (Unit: second) |
| access_token | String | Credential of calling API interfaces. All requests to call API interfaces must carry an access token. |
| refresh_token_expire_time | Integer | Refresh token expire time. (Unit: second) |
| refresh_token | String | Refresh token. refresh_token can be used to obtain new access_token and refresh_token. |
Examples
Request example
POST /openapi/v1.0/get_token
Host: 192.168.5.150:8088
Content-Type: application/json
User-Agent: OpenAPI
{
"username": "UEnH9Dmv6uBJEXsYcag1trNfQThYXXXX",
"password": "ZLcXl63S9EtMnYoHUnjbVo6sA8CbXXXX"
}Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"access_token_expire_time": 1800,
"access_token": "EXZMpZAO86mbrKm6rFtgeb3rfcpC9uqS",
"refresh_token_expire_time": 86400,
"refresh_token": "SCduGecwbG9jIusiS8FxFUVn3kf0Q9R8"
}