Retrieve time series from all variables in a site

Presentation

Description Authorization Method Request
This query retrieves the time series from all variables in a site for a selected time period. Without a selected time period, this query returns only the last value stored in the database. Public GET /v1/sites/:siteID/variables/series

URL parameters

Parameter Type Description
:siteID String Unique site identifier.

URL parameters

Required

None

Optional

Parameter Type Description
from Date The start date of the desired time period. Format: YYYY-MM-DDTHH:mm:ssZ, example: 2014-05-01T22:00:00Z
to Date The end date of the desired period of time. Format: YYYY-MM-DDTHH:mm:ssZ, example: 2014-05-01T22:00:00Z

Successful message

Sample request

    
            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site/variables/series?from=2014-02-11T23:49:00Z&to=2014-02-11T23:51:00Z'
            
            HTTP/1.1 200 OK

            {
              "statusCode": 200,
              "result": [
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:50:01.000Z",
                  "endDate": "2014-02-11T23:50:01.000Z",
                  "variableID": "53bc1a1faa0f163d46c24923",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:50:01",
                      "isodate": "2014-02-11T23:50:01.000Z",
                      "value": "5188"
                    }
                  ]
                },
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:50:01.000Z",
                  "endDate": "2014-02-11T23:50:01.000Z",
                  "variableID": "53bc1a1faa0f163d46c24924",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:50:01",
                      "isodate": "2014-02-11T23:50:01.000Z",
                      "value": "8861"
                    }
                  ]
                },
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:50:32.000Z",
                  "endDate": "2014-02-11T23:50:32.000Z",
                  "variableID": "53bc1a1faa0f163d46c24922",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:50:32",
                      "isodate": "2014-02-11T23:50:32.000Z",
                      "value": "27673"
                    }
                  ]
                },
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:50:32.000Z",
                  "endDate": "2014-02-11T23:50:32.000Z",
                  "variableID": "53bc1a1faa0f163d46c24921",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:50:32",
                      "isodate": "2014-02-11T23:50:32.000Z",
                      "value": "6230"
                    }
                  ]
                },
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:49:36.000Z",
                  "endDate": "2014-02-11T23:49:36.000Z",
                  "variableID": "53bc1a1faa0f163d46c2491e",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:49:36",
                      "isodate": "2014-02-11T23:49:36.000Z",
                      "value": "8818"
                    }
                  ]
                },
                {
                  "count": 1,
                  "startDate": "2014-02-11T23:49:36.000Z",
                  "endDate": "2014-02-11T23:49:36.000Z",
                  "variableID": "53bc1a1faa0f163d46c2491d",
                  "series": [
                    {
                      "timestamp": "2014-02-11T23:49:36",
                      "isodate": "2014-02-11T23:49:36.000Z",
                      "value": "7419"
                    }
                  ]
                }
              ]
            }
            

Details

Parameter Type Description
result Array List of site series by variable.
result[i].variableID String Identifier of the variable.
variables[i].count Number Number of series returned.
variables[i].startDate Date Start date of collection of variable.
variables[i].endDate Date The end date of the collection of the variable.
variables[i].series Array List of series returned by the request
variables[i].series[i].timestamp String Date without timezone as 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 request

            curl -i -X GET 'https://api.openrj.eu/v1/sites/test_site2/variables/series?from=2014-02-11T23:49:00Z&to=2014-02-11T23:51:00Z'
            
            HTTP/1.1 404 Not Found

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

Causes

This site does not exist.

Error message 'from' must be earlier than 'to' & quot;

Sample request

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

            HTTP/1.1 200 OK

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

Causes

The date specified in the & quot; from & quot; Must be less than the specified date & quot; to & quot ;.

Error message & exception; aggregation result exceeds maximum document size (16MB) & quot;

Sample request

            curl -i -X GET 'https://api.openrj.eu/v1/sites/CSTB_SOPHIA/variables/series?from=2011-08-12T00:00:00Z&to=2015-02-11T23:51:00Z'
            
            HTTP/1.1 200 OK

            {
              "statusCode": 500,
              "result": {
                "name": "MongoError",
                "errmsg": "exception: aggregation result exceeds maximum document size (16MB)",
                "code": 16389,
                "ok": 0
              }
            }
            

Causes

The number of series returned is too large. Restart the query by selecting less from-to periods.