POST /chart

The API to retrieve one or more signals data is the following

POST https://api.databoom.com/v1/chart/

To call the API a token OAuth with Read permission is needed.

It is possible to specify some parameters to change the call results:

  • signals is the array of signal ids to retrieve
  • startDate and endDate allow to specify an interval in which retrieve data. Dates format must be YYYY-MM-DDTHH:MM:SS+HH:MM ex. 2018-12-31T08:20:00+02:00;
  • granularity allows to specify the granularity of data to retrieve:
    • a, automatic granularity, provides the better granularity available for the specified interval
    • *, returns all the available data in the interval with a maximum of 10080 values (a value per minute for a week)
    • h, returns a value per hour in the interval
    • d, returns a value per day in the interval
    • m, returns a value per month in the interval

Same call in cURL is

curl -X POST \
  https://api.databoom.com/v1/chart \
  -H 'Authorization: Bearer <OAuth Token>' \
  -H 'Content-Type: application/json' \
  -d '{
	"signals": ["5aa2533bae696741894be82f"],
	"startDate": "2019-05-01T00:00:00+02:00",
	"endDate": "2019-05-07T12:00:00+02:00",
	"granularity": "a"
}'

The API responds with the list of signals specified in the request and their available data in the interval. The info field specifies the granularity applied to each signal and whether all the available values in the interval are returned or the maximum number of values has been reached (overBound).

 


 

Follows an example response, the only signal present is the pressure of weather device of Trento.

{
    "5aa2533bae696741894be82f": [
        {
            "_id": {
                "data": "2019-05-07T09:41:00.000Z"
            },
            "date": "2019-05-07T09:41:00.000Z",
            "mean": 998.3082378029767,
            "total_sum": 9596737.090000015,
            "value": 1019,
            "max_t": 1019,
            "min_t": 1019,
            "total_t": 1019,
            "last_conn": "2019-05-07T09:41:00.000Z",
            "full_value": 0
        },
        {
            "_id": {
                "data": "2019-05-07T08:41:00.000Z"
            },
            "date": "2019-05-07T08:41:00.000Z",
            "mean": 998.3060851019575,
            "total_sum": 9595718.090000015,
            "value": 1020,
            "max_t": 1020,
            "min_t": 1020,
            "total_t": 1020,
            "last_conn": "2019-05-07T08:41:00.000Z",
            "full_value": 0
        }
    ],
    "info": {
        "5aa2533bae696741894be82f": {
            "granularity": "*",
            "overBound": false
        }
    }
}

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.