REST API Dokumentation

Introduction

General

The REST API enables VoIPstudio customers to access to a wide range of resources. Our API has predictable, resource-orientated URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application. JSON is returned by all API responses, including errors.

Endpoints

The base URL for the API id:

https://l7api.com/v1.1/voipstudio/

Authentication

Communications between customer applications and VoIPstudio's API are secured through HTTP basic authentication over SSL.

Before sending requests to the API you must first login using your email address and password or create an API Key to be used for authorization. After successful authentication the API will return a unique user_id and user_token that should be used to login.

E-mail and Password

Login request using e-mail and password:

  curl -H "Content-Type: application/json" -X POST -d '{"email":"jsmith@example.com","password":"$ecretPas$$"}' https://l7api.com/v1.1/voipstudio/login

Example request:

POST /v1.1/voipstudio/login HTTP/1.1
User-Agent: curl/7.26.0
Host: l7api.com
Accept: */*
Content-Type: application/json
Content-Length: 55
Connection: close

{"email":"jsmith@example.com","password":"$ecretPas$$"}

Example of successful response:

  {
    "message":"Login success",
    "user_token":"8e9bc12575e639c993ba5dd8a0e7ce2250211b9a",
    "user_id":123456
  }

REST API Key

To authenticate a user with API Key there is no need to login. The API Key will need to be added for this user in user Advanced tab section (see: https://voipstudio.de/app/#manual.administrator.users.edit).

This API Key should be used in place of the user_token during the login process.

Communication

Authentication to the API is performed via HTTP Basic Auth. This type of authentication should be a straightforward operation in the language that you are using. Incoming requests handled by our API are expected to have a special header with a base64 encoded value built from user_id and user_token returned from a successful "login" response, or user_id and created API Key. To get this base64 value, encode your user_id and user_token separated by a semicolon.

Authorization header is expected in the below format:

Authorization: Basic base64('user_id:user_token')

or

Authorization: Basic base64('user_id:API_Key')

Example of authenticated request:

curl -H "Content-Type: application/json" -H "Authorization: Basic base64('user_id:user_token')"  https://l7api.com/v1.1/voipstudio/cdrs

or

curl -H "Content-Type: application/json" -H "Authorization: Basic base64('user_id:API_Key')"  https://l7api.com/v1.1/voipstudio/cdrs

or simply:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1.1/voipstudio/cdrs

or

curl -u user_id:API_Key -H "Content-Type: application/json" https://l7api.com/v1.1/voipstudio/cdrs

HTTP responses

VoIPstudio REST API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that has failed given the information provided (e.g., a required parameter was omitted, etc.), and codes in the 5xx range indicate a server error.

Each successful response, depending on HTTP method, contains the following properties:

  • GET collection of resources:

    • data - an array of resources data
    • total - total number of resources
  • GET single resource:

    • data - resources data
    • links - links to related resources

Each error response contains the following properties:

  • message - general error message
  • errors - an array of error messages

Pager and filters

For data collection endpoints such as GET https://l7api.com/v1.1/voipstudio/cdrs pager can be used to return a specific number of records from a given page in the data set. To apply pager please append the following parameters to the URL ?page=N&limit=Z where N is a page number and Z is the number of records to be returned (maximum 5000).

To filter data, the filter parameter can be passed as a URL query string. The value of filter parameter has to be JSON encoded string in the format shown below:

[
   {"operator":"like","value":"United States","property":"name"},
   {"operator":"eq","value":10,"property":"price"}
]

Grouping records

group_by parameter is available for grouping records by specific property: ``GET https://l7api.com/v1.1/voipstudio/cdrs?group_by=src`. This parameter should be passed as URL query string.

Click to Chat