Presentation

Description Authorization Method Query
This query is used to retrieve the time series of a variable from a site for a selected time period, and without the selected time period this query returns only the last value stored in the database Public GET /v1/sites/:siteID/variables/:variableID/series

URL parameter

Paramètre Type Description
:siteID String Unique site identifier.
:variableID String Unique identifier of the variable,

Query parameter

Required

None.

Optional

Paramètre Type Description
from Date Start date of the desired period of time Format: YYYY-MM-DDTHH: mm: ssZ, example: 2014-05-01T22: 00: 00Z
to Date End date of the desired time period Format: YYYY-MM-DDTHH: mm: ssZ, example: 2014-05-01T22: 00: 00Z

Successful message

Sample Query

            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site/variables/energy_aircond_1/series?from=2014-02-11T22:00:00Z&to=2014-02-12T22:00:00Z'

            HTTP/1.1 200 OK

            {
              "statusCode": 200,
              "result": [
                {
                  "count": 8,
                  "startDate": "2014-02-11T22:04:43.000Z",
                  "endDate": "2014-02-11T23:49:36.000Z",
                  "variableID": "53bc1a1faa0f163d46c2491d",
                  "series": [
                    {
                      "timestamp": "2014-02-11T22:04:43",
                      "isodate": "2014-02-11T22:04:43.000Z",
                      "value": "7418"
                    },
                    {
                      "timestamp": "2014-02-11T22:19:42",
                      "isodate": "2014-02-11T22:19:42.000Z",
                      "value": "7418"
                    },
                    {
                      "timestamp": "2014-02-11T22:34:41",
                      "isodate": "2014-02-11T22:34:41.000Z",
                      "value": "7418"
                    },
                    {
                      "timestamp": "2014-02-11T22:49:40",
                      "isodate": "2014-02-11T22:49:40.000Z",
                      "value": "7418"
                    },
                    {
                      "timestamp": "2014-02-11T23:04:39",
                      "isodate": "2014-02-11T23:04:39.000Z",
                      "value": "7419"
                    },
                    {
                      "timestamp": "2014-02-11T23:19:38",
                      "isodate": "2014-02-11T23:19:38.000Z",
                      "value": "7419"
                    },
                    {
                      "timestamp": "2014-02-11T23:34:37",
                      "isodate": "2014-02-11T23:34:37.000Z",
                      "value": "7419"
                    },
                    {
                      "timestamp": "2014-02-11T23:49:36",
                      "isodate": "2014-02-11T23:49:36.000Z",
                      "value": "7419"
                    }
                  ]
                }
              ]
            }
            

Details

Paramètre Type Description
result Array List of series of variable.
result[i].variableID String Variable identifier.
variables[i].count Number Number of series returned.
variables[i].startDate Date Start date of collection of the variable.
variables[i].endDate Date End date of collection of the variable.
variables[i].series Array List of series returned by the query.
variables[i].series[i].timestamp String Date without timezone in format YYYY-MM-DDTHH: mm: ss.
variables[i].series[i].isodate String Date with timezone in format YYYY-MM-DDTHH: mm: ss.SSSZ
variables[i].series[i].value Number or String Value of the series to this timestamp

Error Message "Site not found"

Sample Query

            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site2/variables/energy_aircond_1/series?from=2014-02-11T22:00:00Z&to=2014-02-12T22:00:00Z'

            HTTP/1.1 404 Not Found

            {
              "error": "Site not found."
            }
            

Causes

This site does not exist.

Error Message "Variable not found"

Sample Query

            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site/variables/energy_aircond_12/series?from=2014-02-11T22:00:00Z&to=2014-02-12T22:00:00Z'

            HTTP/1.1 404 Not Found

            {
              "error": "Variable not found."
            }
            

Causes

This variable does not exist.

Error Message "'from' must be earlier than 'to'"

Sample Query

            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site/variables/energy_aircond_1/series?from=2015-02-11T22:00:00Z&to=2014-02-12T22:00:00Z'

            HTTP/1.1 200 OK

            {
              "statusCode": 400,
              "result": {
                "error": "\"from\" must be earlier than \"to\""
              }
            }
            

Causes

The date specified in the parameter "from" must be less than the specified parameter date"to".