Rainbow Metrics Portal (1.236.0)

Download OpenAPI specification:Download

Rainbow metrics portal API guide

Preamble

Download Postman collection

Introduction

This guide describes list of API services that are provided by OT Rainbow metrics portal.

Protocol

REST interface is used for sending/receiving OT rainbow API messages. HTTP requests GET, DELETE, POST, UPDATE are used. Standard HTTP responses are used to provide requested information or error status. There is no session notion in OT Rainbow system, so requests could be issued according stateless model, without transport conservation between them. Additional data could be provided in message body. JSON is used as a main format for data encoding in message body part. Each request is started with the following pattern /{module}/{version}/ where {module} is a portal module name to address and {version} is a version of used API, par example, “v1.0”.

Security considerations

Each request should contain some credential information to authenticate itself. Standard HTTP authentication with basic/bearer modes is used. JSON Web Token mechanism is used to provide authentication information. JWT has a expire timeout that is controlled by OT Rainbow portal to prevent very long token usage. Also authentication with application token is used. The token must be provided in the request HTTP header, using a custom header: APIKey. At server side, token is verified, and if it doesn’t match, 403 Not Allowed response is sent. TLS is used as a transport protocol to support message exchanges between OT Rainbow portal and an application.

Authentication

Bearer

For accessing the API a valid JWT token or a valid OAuth has to be provided access token must be passed in all the queries in the 'Authorization' header.

  • JWT
    • A valid JWT token is generated by the API and returned as answer of a call to the route GET /api/rainbow/authentication/v1.0/login giving a valid user & password.
    • The following syntax must be used in the 'Authorization' header:
      Bearer xxxxxx.yyyyyyy.zzzzzz
  • OAuth access token
    • A valid OAuth access token is generated and returned as answer of the OAuth 2.0 workflow with authorization code grant. This is done by calling the route GET /api/rainbow/authentication/v1.0/oauth/authorize to get an authorization code and then POST /api/rainbow/authentication/v1.0/oauth/token to exchange it agains an access token and a refresh token.
    • The following syntax must be used in the 'Authorization' header:
      Bearer xxxxxx.yyyyyyy.zzzzzz
Security Scheme Type API Key
Header parameter name: Authorization

Bearer-x-rainbow-api-key

For accessing the API a valid API_KEY can be provided instead of Authorization Bearer JWT header

Security Scheme Type API Key
Header parameter name: x-rainbow-api-key

Analytic Metrics

Get all companies stats of a bpadmin.

This API can be used to retrieve stats of all companies under the given bpadmin

path Parameters
companyId
required
string

Company unique identifier (like 578bb08dc0d8c107725ef8c4).

query Parameters
limit
number
Default: 100

Allow to specify the number of stats to retrieve.

offset
number

Allow to specify the position of first stats to retrieve (first app if not specified). Warning: if offset > total, no results are returned.

sortOrder
number
Default: 1
Enum: -1 1

Specify order when sorting stats list (sort is done on users.total field).

header Parameters
accept
required
string

application/json

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "limit": 100,
  • "offset": 0,
  • "total": 8
}

Get companies stats

This API can be used to retrieve stats for a given company or grouped stats of all companies under a given BP company

path Parameters
companyId
required
string

Company unique identifier (like 578bb08dc0d8c107725ef8c4).

query Parameters
scope
string
Default: "ec"

Allow to specify if the returned stats are from all companies under bp and itself (scope=bp) or stats concern only the specified company (scope=ec).

header Parameters
accept
required
string

application/json

Responses

Response samples

Content type
application/json
{
  • "companyId": "595f7c109b43a2ba5dcbb1f9",
  • "scope": "bp",
  • "bps": [
    ],
  • "companies": 7,
  • "companyName": "Chin BP company",
  • "subscriptions": {
    },
  • "systems": {
    },
  • "users": {
    },
  • "usages": {
    },
  • "lastDataCollectDate": "2018-02-12T00:00:00.000Z",
  • "id": "5a4f47869e8ef2d74f74e520"
}

Get day to day stats for companies

This API can be used to retrieve daily stats for a given company or grouped stats of all companies under a given BP company

path Parameters
companyId
required
string

Company unique identifier (like 578bb08dc0d8c107725ef8c4).

query Parameters
scope
string
Default: "ec"

Allow to specify if the returned stats are from all companies under bp and itself (scope=bp) or stats concern only the specified company (scope=ec).

header Parameters
accept
required
string

application/json

Responses

Response samples

Content type
application/json
{
  • "companyId": "58384af3d8279feeccc61984",
  • "scope": "ec",
  • "bps": [ ],
  • "companies": 0,
  • "companyName": "Ma boite",
  • "dailyStats": [
    ]
}

Get first level clients stats of companyId or itself if EC

This API can be used to get stats (aggregated if BP) of first level customers for a given BP. If the company is an EC, it returns stats of this EC only.
The response of this API can be used to easily build a CSV file for an export of the analytics docs.

path Parameters
companyId
required
string

Company unique identifier (like 578bb08dc0d8c107725ef8c4).

header Parameters
accept
required
string

application/json

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Cpaas Metrics

Retrieve CPaaS metrics for an application.

Rainbow users with developer role can create applications and can retrieve CPaaS metrics for their own applications.
'fromDate' parameter to 'toDate' parameter range are restricted according the value of 'period' parameter:

  • 8 days for an 'hour' period,
  • 32 days for a 'day' period,
  • 366 days for a 'month' period
path Parameters
applicationId
required
string

Application unique identifier (like 578bb08dc0d8c107725ef8c4).

query Parameters
fromDate
required
string <date-time>

Allows to filter CPaaS counters from provided date (ISO 8601 format, ex: 2018-08-01T09:30:00Z).
fromDate must be lower than toDate.

toDate
required
string <date-time>

Allows to filter CPaaS counters until provided date (ISO 8601 format, ex: 2018-08-07T18:00:00Z).
toDate must be greater than fromDate.

period
string
Default: "hour"
Enum: "hour" "day" "month"

Aggregation period, if not provided default value is 'hour'

groups
string

Allows to filter CPaaS counters for specific CPaaS metric groups: groups should be comma separated (like login,users,administration)

timezone
string
Default: "UTC"

Allows to filter CPaaS counters using a specific time zone.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "aggregationPeriod": "hour"
}

Retrieve the mapping of CPaaS metric groups.

Retrieve the mapping of CPaaS metric groups.

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve aggregated CPaaS metrics for all applications of an application owner.

Rainbow users with developer role can create applications and can retrieve CPaaS metrics for their own applications.
'fromDate' parameter to 'toDate' parameter range are restricted according the value of 'period' parameter:

  • 8 days for an 'hour' period,
  • 32 days for a 'day' period,
  • 366 days for a 'month' period
query Parameters
ownerId
required
string

Owner unique identifier.

fromDate
required
string

Allows to filter CPaaS counters from provided date.

toDate
required
string

Allows to filter CPaaS counters until provided date.

period
string

{hour, day, month} Aggregation period, if not provided default value is 'hour'

groups
string

Allows to filter CPaaS counters for specific CPaaS metric groups: groups should be comma separated (like login,users,administration)

dcZones
string

Allows to filter CPaaS counters for specific dcZone(s): dcZones should be comma separated (like EU,NA).

timezone
string
Default: "UTC"

Allows to filter CPaaS counters using a specific time zone.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "aggregationPeriod": "hour"
}