REST API

Overview

What is REST?

For a subjective definition of the term “Representational State Transfer” please refer to the Wikipedia REST Article.

The main features of a REST Interface include:

  • Providing access to readable/writable structured data via HTTP
  • each resource in the system, e.g. a user of the Telephone system, has their own URI
  • The Protocol is Stateless an has no sessions
  • It is lightweight
  • There are no formal Interface descriptions, unlike with SOAP Web Services for example
  • In the simplest scenario, you can use data interrogation tools such as wget, curl or simply direct from your browser
  • HTTP Header and Return Codes are used extensively. Requests to non-existing data objects will be answered with, for example a HTTP 404 Return code.

What I can do with the it?

You can, for example, trigger calls for a particular user via REST- Request or call up related call data. pascom provides you with a multitude of options which are available.

How is the data formatted?

All URI’s return all your content in the form of JSON Data. This has the advantage that the data is very easy to parse and process in all common programming languages. Compared to XML, JSON is somewhat more compact.

Below is an extract from the Return Information from the request for data relating to the user tmattausch:

http://IP_OF_PASCOM/services/identity/tmattausch

Looks somewhat similar to:

...
"014use_calleridnum": "",
"014use_exttimeout": "30",
"014use_extrcd": "nein",
"014use_extrcdallow": "ja",
"014use_intercom": "nein",
"014use_inttimeout": "25",
"014use_intrcd": "nein",
"014use_intrcdallow": "ja",
"014use_name": "tmattausch",
...

Configuration

Setting up a User

In order to be able to access the REST-API, you have create a user for this purpose. To do this, log in via SSH to the pascom (see Access to pascom) and become root.

Now setup the desired user with the following command:

htpasswd -b /etc/apache2/users.ht YOUR_USER YOUR_PASSWORD

Initial Access

Call up the URL http://pascom_PBX_IP/services

Screenshot - pascom REST API

pascom will then display the REST-API Documentation. Within the REST Interface, all the available REST prompts are listed and can be tested them before you install the URL prompts into an application.