Skip to content

API guide

skovzhaw edited this page Sep 19, 2016 · 45 revisions

Universal interface

All the core RCB Cyclops micro services offer the same HTTP RESTful API interface. You can rely on this structure to be always present, therefore you can write your own applications or visual interfaces on top of them, where it doesn't matter whether it is UDR, CDR or Billing micro service, as they all work in the same fashion.

Pagination

In order to guarantee that all API queries are performant (based on administrator's wishes), all responses are paginated. Which means that if your query execution contains 20'000 records, but administrator specified page size limit of 5'000, you will only get a subset of data. However, you will also see the following metadata:

  • displayedRecords - number of returned records
  • totalRecords - number of total records
  • pageNumber - what page are you looking at
  • pageSize - what is the page limit size

If you are running autoscaler or are scaling in/out containers, effectively spawning new instances on peak loads, you can easily parallelise these queries and ask for more than just one page at the time. You will still need to collect all the data for queries you want to execute manually and traverse all the pages, in order to have a guarantee that micro services will have desired performance.

Data ingestion

We highly recommend to use RabbitMQ messaging for data delivery for all of your own usage collectors. However, in case that your application scenario relies on it, RCB Cyclops framework also allows for RESTful data ingestion, simply by sending POST requests with the same structure as you are used to with RabbitMQ, but over HTTP:

Commands

It is paramount that commands are properly delivered and executed, therefore we highly recommend using RabbitMQ delivery mechanism when developing and executing supported commands. However, in certain cases your scenarios may require RESTful command execution over HTTP, mainly when you expect to receive a synchronous response.

In order to do so, simply send POST request to the following endpoint

Yet, make sure you are following the same message format as with command execution using RabbitMQ. There is no real difference in what commands you can use via AMQP and RESTful, both means of delivery will always work.

However, RabbitMQ only allows for asynchronous command execution, where if you choose to use RESTful API you will have an option to use synchronous messaging, by returning JSON representation of specified object over HTTP.

Queries

Individual micro services expose their records via GET request on the following endpoint

Which means that UDR micro service returns UDR records, RC micro service its CDR records and Billing micro service generated Bills.

Filtering

In order to request UDR, CDR or Bill records only for a selected account, simply add an account

Pagination

If you see that what you've received is just a first page of many, you can simply add page

Date range

Optionally you can also specify from and to parameters, either both of them, or just one

The timestamp format is a well known Unix time, where the API interface expects seconds.