Brekeke PBX Wiki

8. How to call PAL methods via REST API

Assumptions:

Initial Setup of Brekeke PAL is completed.

– Except on the login method, all parameters and returns used on the methods are same as the JSON RPC on the PAL WebSocket.

POST request method is always used on PAL REST API.

 

Syntax:
http(s)://<host>:<port>/pbx/api/pal/<method name>

 

 

Authentication:

Call login method to obtain the token at first. Then on subsequent methods, set the obtained token in the Authorization headers as follows;

Authorization: basic <token>

 

 

login method:
Parameters
Parameter Explanation
tenant Tenant name
login_user PBX user
login_password Login password
Return
token Token that will be used for calling subsequent methods

 


Test 1. Login test with Postman.

Step 1. Open Postman. Then Create a POST request.

  • Enter appropriate URL of your PBX’s PAL.
  • Open the [Headers] tab and set “Content-Type” as “application/json“.

 

Step 2. Open the [Body] tab and select “JSON“. Then add parameters and values with JSON format.

Click [Send] button.

 

Step 3. If  the 200 OK response is receved and a token is obtained like the picture, the connection is succeeded.

 

 

 

Test 2. Test with a sample script.

Refer to the “PAL REST API – Sample program 1”>>

 

 

Yes No
Suggest Edit