Login
Note:
-
You need to encrypt the API password with MD5 first, and use the MD5 password to log in. The MD5 password should be in the format of 32 lowercase letters.
-
If you log in failed consecutively for 5 times, you need to try after 10 minutes.
-
The port number of UC’s HTTP API is 9011.
Endpoint
POST /api/v0.0.1/login?type={type}
Request Parameters
|
Required |
String |
The PBX API’s username. |
|
Required |
String |
The PBX API’s password. Encrypt the password with MD5, then fill in the encrypted 32 lowercase letters. |
|
Required |
String |
The API port number that is set on 3rd-party application. The PBX will send API reports to the 3rd-party application via this port. |
|
Optional |
String |
URL of the application server. This URL is used to specify the sending path of event report to the application server. Note: If the parameter is not specified, the event report will be sent to the IP address of the application server. |
|
Optional |
String |
The version of API reports format. Note:
|
|
Optional |
String |
Specify the URL type:
Note: Using an absolute URL will ensure the API reports to be sent successfully in an complicated network environment. |
Response Parameters
|
String |
Token for interface invocation. |
Note:
-
All API requests should contain an API
token
. The APItoken
is generated when the 3rd-party application server logs in the PBX API successfully. -
The API
token
is valid in 30 minutes.
Within the validity time of the token, if there is no event interaction between the API and the application server ( for example, the application server sends API request to the PBX, or API sends event report to the application server), the token will be erased by the IPPBX.The application server can prolong the validity time of the token by sending a Heartbeat packet to the PBX via the Heartbeat packet interface. Every time a packet is sent, the token validity time will be prolonged for 30 minutes.
Examples
Request Example
POST /api/v1.1.0/login?type=json HTTP/1.1
Content-Type:application/json; charset=utf-8
Host: 172.16.101.37
{
"username": "xiaoshao",
"password": "e10adc3949ba59abbe56e057f20f883e",
"port": "8260",
"version": "0.0.1",
"url": "172.16.6.150:8260",
"urltag": 1
}
POST /api/v1.1.0/login?type=xml HTTP/1.1
Content-Type:application/xml; charset=utf-8
Host: 172.16.101.37
<?xml version="1.0" encoding="UTF-8" ?>
<xml>
<username>api</username>
<password>e10adc3949ba59abbe56e057f20f883e</password>
<port>8260</port>
<version>0.0.1</version>
<url>172.16.6.150:8260</url>
<urltag>1</urltag>
</xml>
Response Example
Login success.
HTTP/1.1 200 OK
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
{
"status": "Success",
"token": "813b621cfe8eecf445a2ce1f4a079ffe"
}
Login failure.
HTTP/1.1 200 OK
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
{
"status": "Failed",
"errno": "30003"
}