Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Management API allows you to easily integrate 3rd party applications with the VCS platform. It may be accessed using JSON-RPC - a standard protocol for remote procedure calls.  

...

To access JSON-RPC interface, use:

Code Block
languagebash
https://<your-system-IP>/jsonrpc/

Before accessing the system, make sure that your IP is allowed on the firewall. Also, please make sure that rest of the world is blocked by firewall. You can get more details about it in the VCS First Steps.

Authentication

In order to To make any request to the API, you need to authenticate using login and password.

...

Code Block
languagejs
{ "auth": { "login": "admin", "password": "password" } }

In order to To increase performance, you may not authenticate for each call but do it once and save Session ID given back to you in response.
This Session ID may be sent in further requests instead of login and passwords to continue using the same session without re-authentication. Session ID should be sent with other arguments in the following format:

...

NameDescriptionExample

code

Return code, usually true on success or false on failure
1

return

Array with data returned by method
[client] => Array
(
[id] => 11
[id_companies] => 3
[type] => 0
[name] => Customer A
[groups] => Customers
[c_dt] => 2013-03-30 16:26:15+03
[status] => active
[credit] => 100
...
)
session_idSession ID, which may be used to speed up next calls
1-dsglnqr4qnsdihr8djj6da7qr4
messagesList of success / warning messages returned by message
array()
errorsList of abnormal errors if they fired during processing
array()

...

There is a specific case when your request to the billing should provide file response. For example, it could be an invoice file download, CDRs xDRs List download, etc. Using plain JSON-RPC with base64 on top of it is not effective here as the file may contain hundreds of megabytes. This special case is handled with common HTTP Request to:

...

The request may be either GET or POST, and should include either Login and Password or Session ID. In response, the server will send the file according to HTTP protocol.

...

At the moment we are working hard to bring you a full and detailed list of methods, arguments and expected output. However, as API fully duplicates web methods, it is easy to find their names and arguments yourselvesyourself. Let's check a quick example, like creating a reseller. 

In the web interface, the link to this action is https://<your-billing-IP>/admin/companies/add, with companies being a module and add being a method.
The resulting method to call via API is companies.add

In order to To find out arguments for this method, you may look for HTTP request in your browser (using FireBug in Firefox, Developer Tools in Chrome). Another way is to check for dump in /opt/jerasoft/vcs-data/log/runtime.log, which looks like:

Code Block
[20-Jan-2012 17:32:06+0200] [webAdmin/#260808] REQUEST: /companies/add 
Array 
( 
	[type] => 10 
	[name] => TESTCOMPANY 
	[id_companies] => 
	[prepaid] => 1 
	[credit] => 0.00 
	... 
)

This log entry includes the full list of the arguments used. However, many of them are optional. Try calling the method with the arguments you need, and the system will let you know if you are missing any of the arguments.

...