When the Application receives a provisioning event, it connects to PortaBilling via the XML (SOAP) or JSON (REST) API to retrieve the information about the modified entity.
Connection to the XML/JSON API is provided via HTTPS.
To access the XML API, SOAP requests to PortaBilling API must be sent to the following URL: https://portabilling-web.yourdomain.com:port/soap/service/method
To access the REST API, JSON requests to PortaBilling API must be sent to the following URL: https://portabilling-web.yourdomain.com:port/rest/service/method
Replace the portabilling-web.yourdomain.com with the actual hostname of the PortaBilling web server.
Replace ‘port’ with the required port. The SOAP/JSON interface is available for administrators on port 443.
Replace ‘service’ with the API service that contains the required method (e.g., specify the Account service to manage account information.)
Replace ‘method’ with the required API method (e.g., specify get_account_info method in order to get an account record from the database.)
The Content-Type header field used with a HTTPS POST request must have one of the following values:
- application/x-www-form-urlencoded
- multipart/form-data
The body of the POST request must contain the following parameters (in JSON format):
- auth_info – the mandatory authentication information such as login-password or login-API token for the admin web interface, or a session ID.
- params – a set of method parameters (in JSON format) that depend on a method structure. Note that method parameters and their structures are the same as those in the SOAP.
Here is an example of POST request with these parameters (in JSON format):
auth_info={“session_id”:”527865ee75368ff2d2c4f4881″} params={“i_account”:1000889,”get_included_services”:1}
POST /rest/Account/get_account_info HTTP/1.1 Host: demo.portaone.com Content-Type: application/x-www-form-urlencoded Content-Length: 139 auth_info=%7B%22session_id%22%3A%22527865ee75368ff2d2c4f4881%22%7D¶ms=% 7B%22i_account%22%3A1000889%2C%22get_included_services%22%3A1%7D |
To access the PortaBilling web server, the login request must contain a pair: a user login and either the API access token or the user password for the admin web interface. Here is an example of the POST request with these parameters:
params={“login”:”demo”,”password”:”exAmple”}
POST /rest/Session/login HTTP/1.1 Host: demo.portaone.com Content-Type: application/x-www-form-urlencoded Content-Length: 70 params=%7B%22login%22%3A%22demo%22%2C%22password%22%3A%22exAmple%22%7D |
The response returns the session ID value:
{“session_id”:”527865ee75368ff2d2c4f4881cd2758a”} |
Please note that we strongly recommend to use the session_id for further requests. Otherwise, if you use the login-password or the API access token authentication pairs for every request, new sessions will be created and cause additional load to the database.
For more information about PortaBilling API please refer to the PortaBilling API guide.