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.
Prerequisites
You have enabled the API feature on the Yeastar P-Series Cloud Edition. For more information, see Enable Yeastar P-Series Cloud Edition API.
Request URL
POST {base_url}/{api_path}/get_token
Request Parameters
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.
Note: You can check the error code and
error message in Error Code and Error Message.
|
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.
|
Examples
POST /openapi/v1.0/get_token
Host: yeastardocs.example.yeastarcloud.com
Content-Type: application/json
User-Agent: OpenAPI
{
"username": "UEnH9Dmv6uBJEXsYcag1trNfQThYXXXX",
"password": "ZLcXl63S9EtMnYoHUnjbVo6sA8CbXXXX"
}
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"
}