Get API token
Yeastar Cloud PBX API uses username and password for authentication. PBX API only handles the requests with a valid token.
If login fails for five times, domain of the application server will be locked for 10 minutes. You can log in PBX web interface and delete blocked API IP.
Request URL
{base_url}/{api_path}/login
Request parameters
Parameter | Required | Type | Description |
---|---|---|---|
username | Yes | String | Username in API Settings on PBX. |
password | Yes | String | Encrypt the password in API Settings on PBX using MD5 (Message-Digest Algorithm) . Enter the encrypted 32-digit lowercase string. |
version | No | String | Format version of event reports. Note:
|
port | No | String |
The application server would monitor the port and receive events sent from PBX through this port.
Default value: 8260. |
url | No | String | URL of the application server. This URL is used to specify the sending path
of events to the application server. Note:
|
urltag | No | String | Specify the URL type. Note:
Valid values:
Default values: 0. |
Response parameters
Parameter | Type | Description |
---|---|---|
status | String | Request result.
|
token | String | Credential of calling API interfaces. All requests to call API interfaces must carry a token. |
refreshtoken | String | Use refreshtoken to obtain new token and
refreshtoken . |
transport | String | The transport of API events.
For events details, refer to API Events. |
Examples
Request example
POST /api/v2.0.0/login HTTP/1.1 Content-Type:application/json; charset=utf-8 Host: api.yeastarcloud.com { "username": "api", "password": "2d7257a528679d01a19c70e3fa773870", "port": "8260", "version": "2.0.0" }
Response example
login success.
HTTP/1.1 200 OK Connection: close Content-Type: application/json Access-control-allow-origin: * Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE { "status": "Success", "token": "2bc5a7494ef88b0506da66c60ccf232d", "refreshtoken": "58f29c380365e5546cd3ac8c34edc88c", "transport": "TCP" }
HTTP/1.1 200 OK
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
{
"status": "Failed",
"errno": "30003"
}