How to use API
API Examples
1.Environmental preparation
API tool: Postman
API tool access: https://dl.pstmn.io/download/latest/win64
Password conversion tool: https://www.miraclesalad.com/webtools/md5.php
2. Foreword
Most of the API functions of OIAD need a token, so you need to use the login request to get the token, which is valid for 600 seconds, and you can set the validity time on the page.
Figure 2-1 Expiry Date Setting Screen
Select POST, enter http://Device IP/controller/API function, enter {“username”: “username”, “password”: “converted password”} in the Body field, and finally click Send.
Figure 2-2 Get token interface
If the fetched token is about to time out, but there is no other API you need to use, but you don’t want to re-fetch the token, you can manually refresh the token’s expiration time. In the POST column, enter http://Device IP/controller/API function, in the Body column, enter {“token”: “95c2302f649e366813420cd6567d88b3”}, and finally click Send, the response is as shown in the figure that refreshes successfully.
Figure 2-3 Refresh Time Screen
3.Example of a login request /auth/login
Select POST, enter http://Device IP/controller/API function, enter {“username”: “username”, “password”: “converted password”} in the Body field, and finally click Send, you can see whether it was sent successfully or not through the response box at the bottom. The successful response should be
{
"uri": "auth/login",
"msg": "",
"code": 200.
"data": {
"level": "admin",
"token": "582f5126c311231224922ee980311834"
}
}
Figure 1-1 Example of a Login Request
4.Example of VOIP settings /analog/voip_set
After login to get the token, then used for VOIP settings and other interfaces, the following is the example of VOIP settings
Select POST, enter http://Device IP/controller/API function, and in the Body field enter
{
"sip_anonymous": "no",
"in_ringtime": 65,
"out_ringtime": 65,
"user_agent": "OIAD".
"timer_t1": 500,
"timer_t2": 4000,
"allow_tx_hash_in_uri": "no",
"timers": "yes",
"timers_min_se": 100,
"timers_sess_expires": 2000,
"cadence": [
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000".
"250,250,500,1000,250,250,500,4000."
],
"sip_cid2": 1,
"calltimeout": 43200000.
"net_failover": "no",
"early_media": "yes",
"ring_cadence": 0,
"ring_alert_info": [
{
"Bellcore-dr3": "1"
},
{
"Bellcore-dr5": "4"
}
],
"ring_caller_id": [
{
"10": "1"
},
{
"102": "5"
},
{
"": "1"
},
{
"": "1"
},
{
"1": "1"
}
],
"g723_rate": "63".
"ilbc_mode": "30",
"token": "582f5126c311231224922ee980311834"
}
Finally, click Send and you can see if the send was successful with the response box at the bottom. The successful response should be
{
"uri": "analog/voip_set",
"msg": "",
"code": 200.
"data": []
}
Figure 4-1 Example of VOIP Settings
Appendice
If there is no prompt in the API documentation for Client→Server Request, it is the default to fill in the token.