...
IPBX API - centralized API containing a wide range of management/configuration options
Local API (deprecated) - API running on each PBX, it will be a part of IPBX API in the future
Working with IPBX API.
Prerequisites
Shell with
curl
andjq
installedCreate user account - Komunikátor - modul administrace uživatelů s licencí Volání, Komplet, Callcentrum
Authentication
Authentication is based on providing Bearer {access_token}
into Authorization
header with every request. To obtain an access_token
, make POST request to https://restapi.ipex.cz/v1/sso/login
with credentials contained in the body.
Example of fetching the access_token:
...
1. Creating API Access
You can create API access in the IPEX Portal https://portal.voipex.io/.
You choose API access in the section For Developers.
...
You can create your API access by pressing the button in the top right corner “Create access”.
...
You need to fill in this information:
E-mail - write your username
Password - you can choose between custom or use generated, if needed, press the question mark to get help
Switchboard - select by clicking the arrow on the right
Impersonation - by checking Impersonation, you will get access to all user's API functions and you can impersonate a user
- if you leave the box unchecked, you will only have access to the Rest api (calls log, switchboard)
2. Authorization
Our API uses OAuth 2.0
password grant flow to allow you to access data from .. .
Obtaining a Token
The access token is obtained by making POST
request to authorization endpoint https://auth.voipex.io/token
. The post body must be formatted by using x-www-form-urlencoded
.
Parameter | Value |
---|---|
| password |
| api |
| <access_email> |
| <access_password> |
| openid profile |
Example:
curl -d "grant_type=password&client_id=api&username=<access_email>&password=<access_password>" -H "Content-Type: application/json" -d '{"email": "email@ipex.cz", "password": "password123"}' x-www-form-urlencoded" -X POST https://restapiauth.ipex.cz/v1/sso/login | jq ".access_token"
The voipex.io/token
Refreshing a Token
The access token is valid for 1 hour50 minutes. After expiration, the token must be restored with refresh_token
obtained also in response from /v1/sso/login
. More information is avalable on documentation page for REST API.
Example of refreshing token:
curl -X POST -H "Content-Type: application/json" -H "Authorization: f2e067729edd170d9c60" https://restapi.ipex.cz/v1/sso/refresh
Calling the API
that time the client needs to obtain a new access token by using refresh_token
and making aPOST
request to authorization endpoint URL (https://auth.voipex.io/token
). The post body for this specific method must also be formatted by using x-www-form-urlencoded
.
Parameter | Value |
---|---|
| refresh_token |
| api |
| <refresh_token> |
Example:
curl --location --request POST 'https://auth.voipex.io/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=api' --data-urlencode 'grant_type=refresh_token' --data-urlencode 'refresh_token=eyJhb...'
Impersonification
POST
request to https://auth.voipex.io/token-exchange
. Access e-mail is e-mail of user for whom the impersonation will be performed. The impersonification can be performed by the user who has impersonation enabled in the api access.
Parameter | Value |
---|---|
| <email/login assigned to a user that you want to impersonate> |
Example
curl --location --request POST 'https://auth.voipex.io/token-exchange' --header 'Authorization: Bearer eyJhb...' --header 'Content-Type: application/json' --data-raw '{"email": "<email>"}'
3. Using our API
Access token is provided in Authorization
header with every request in Bearer <access_token>
format. The best way to try our API is to visit the documentation page. Before making requests, copy your token to the input field in topbar (do not forget to add Bearer
before the token).
...