CPaaS API provides a programming interface to enable these services by creating, managing projects, configuring services therein, and getting reported.
Table of Contents
Overview
CPaaS API helps easily integrate Video into Third Party Applications. Here are some interesting key points:
Accessibility
CPaaS API can be accessed using Server-to-Server Call using HTTP Base Authentication. This helps Developers to integrate API Server based Application.
Role Based Authorization
Role-based access to different API Routes and data therein. API gives access to data in the following hierarchy:
- Administrators – Role Access to data of Customers.
- Customers – Role Access to own data.
Basic Functions
- Project Management
- Data Pool Management
- Report Management
API Host URL
API Host: https://api.enablex.io/cpaas/
All CPaaS API Routes are mapped to the API Host URL, e.g.
Project Route URL: https://api.enablex.io/cpaas/projects
API Authentication
HTTP Basic Authentication – For Server to Server API Call
The CPaaS API uses HTTP Basic Authentication mechanism to authenticate API calls. Each API call is validated via the authentication header. This suits best to integrate EnableX with Server Side Code. The API Access Credentials be saved on Server and used for Server-to-Server Call.
You need API ACCESS ID and API ACCESS KEY for HTTP Basic Authentication. These are to be used as API Access Credentials from your Application Server in each API Call.
- API ACCESS ID: Use it as username for HTTP Base Authentication
- API ACCESS KEY: Use it as password for HTTP Base Authentication
POST https://api.enablex.io/cpaas/projects Authorization: Basic XXXXXX Content-Type: application/json
The Authorization
header in the above example contains a value XXXXX which is a base64 encoded string of the API ACCESS ID:API ACCESS KEY.
How to get API ACCESS ID & API ACCESS KEY
Every Customers can get access to API Access for Application Integration. To get API Access Credentials, follow the given steps:
- Login to EnableX CPaaS Portal
- Navigate: {Main Menu} Developers / API Access
- Click “Generate API Credentials” (If you are first time API User). Subsequently, you will get API Credentials readily available on this page.
API Responses
The CPaaS API call make use of JSON Result Code to determine if the API call is successful.
Success JSON
Successful CPaaS API calls will always return HTTP 200 with JSON Body having Result Code as result: 1
.
{ "result": "1", "data": { } }
The data
object is optional and its a dummy name. It will be named after requested data and will contain related key-fields.
Error JSON
If unsuccessful, for whatever reason, the UCaaS API will return a JSON with a non—zero result code. An error response in JSON will always carry 3 keys, viz. Result Code, Error, Description. See example below:
{ "result": "1504", "msg": "Duplicate data", "desc": "Email Address is already registered", "data": { "email": "[email protected]" } }
Result Code Grouping
The HTTP Response Codes of CPaaS API are grouped into 5 categories as shown in the table below:
Code | Category | Description |
---|---|---|
1xx | Information | Request received & processed. |
2xx | Success | Request received & accepted. |
3xx | Redirection | Action required to complete Request. |
4xx | Client Error | Illegible Request Syntax. Can’t be fulfilled. |
5xx | Server Error | Server failed to complete a legit Request. |
Error Codes
Common HTTP Status Codes
Code | Description |
---|---|
200 | OK success status: the request has succeeded. |
400 | Header is missing. Add a valid header. |
401 | Invalid header used. |
403 | Token has expired. |
404 | Not Found. |
406 | Unprocessable entity, validation failed. |
500 | Internal Server Error. |
1001 | Token is not valid. |
1002 | The request is invalid. |
Application Specific Common Error Codes
Code | Description |
---|---|
0 | Error. |
1 | Success. |
1401 | App type must be specified. |
1402 | App type must be a string. |
1403 | Only Valid app-type should be passed. |