Proxyapi: Difference between revisions

From MiRTA PBX documentation
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:


$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=tenant";
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=tenant";
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_VERBOSE, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, "jsondata=".urlencode(json_encode($config)));
$data = curl_exec($resource);
curl_close($resource);
print_r($data);
</pre>
=== Updating a tenant ===
<pre>
$config['te_id']="460";
$config['te_name']="Relax and entertainment";
$config['pk_end']=820;
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=tenant&objectid=460";
$resource = curl_init();
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_URL, $url);

Revision as of 07:01, 24 April 2017

Proxyapi is the way to manage your PBX from external softwares. It allows easy access to calls, phone status and more. It allows also to create, delete and edit records, even if in a limited way.

Proxyapi can be used by each tenant using an API key generated in the Configuration/Settings page. Two kinds of keys can be generated, one allowing Read/Write access and one allowing only read-only operations.

The latest syntax for the operations can be retrieved by proxyapi itself, like for example: https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=HELP

Some usage example examples:

ManageDB / Tenants

Getting the tenant list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=list

Getting info for a tenant

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=get&objectid=1

Creating a tenant

$config['te_code']="RELAX";
$config['te_name']="Relax & entertainment";
$config['pk_start']=800;
$config['pk_end']=810;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=tenant";
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_VERBOSE, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, "jsondata=".urlencode(json_encode($config)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);

Updating a tenant

$config['te_id']="460";
$config['te_name']="Relax and entertainment";
$config['pk_end']=820;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=tenant&objectid=460";
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_VERBOSE, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, "jsondata=".urlencode(json_encode($config)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);