Get Samples for a Timeseries

This endpoint is used to get samples for a single timeseries ID and metric within a specific time period. If the startTime and endTime parameters are not provided, it returns all the samples. To avoid an overflow number of returned samples, you can pass the limit parameter.
The only required parameter for this endpoint is the timeseriesId.

URL

https://{{HOST}}/timeseries/timeseries/{timeseries_id}/samples

Method

GET

Required IMS Scopes

  • Read
  • Write

Required ACL Permissions

  • owner
  • admin
  • readwrite
  • readonly

Versions Supported

  • 2.0 (Default)
  • 2.1

URL Path Parameters

Name Description Example Type
timeseries_id
required
Timeseries ID from which to get samples GUID string

URL Query Parameters

Name Description Example Type
$query
optional
Query to get specific results /endpoint/?$query None
v
optional
Version of the API to use v=2.0 string
startTime
optional
Starting time of the target period 2018-01-01T00:00:00+00:00 ISO 8601 string(date-time + offset)
endTime
optional
Ending time of the target period 2018-12-31T23:59:59+00:00 ISO 8601 string(date-time + offset)
limit
optional
Limit the number of samples returned to this number 10 integer(int32)
metric
optional
Metric from which to query the samples Raw string
orderby
optional
Order the returned samples based on the element provided. The format is to provide one of the fields in the sample JSON space-seperated by asc/desc to choose ascending/descending order timestamp desc string

Request Header Parameters

Type Value Description
Authentication Bearer {access_token}
required
Retrieve access token

Example

Request

curl -X GET 
  'https://{{HOST}}/timeseries/5d33771d-d87a-4635-9af9-3998744ae33f/samples' 
  -H 'Authorization: Bearer {access_token}' 
  -H 'Cache-Control: no-cache' 

Response

[ 
  { 
    "timeseriesId": "5d33771d-d87a-4635-9af9-3998744ae33f",
    "unixTimestamp": 1487968800000,
    "ingestUnixTimestamp": 1488090243352,
    "timestamp": "2017-02-24T20:40:00+00:00",
    "val": 12,
    "metric": "Raw",
    "customData" : 
    {
      "reliability": 1
    }
  },
  { 
    "timeseriesId": "5d33771d-d87a-4635-9af9-3998744ae33f",
    "unixTimestamp": 1487968500000,
    "ingestUnixTimestamp": 1488090243352,
    "timestamp": "2017-02-24T20:35:00+00:00",
    "val": 11,
    "metric": "Raw",
    "customData" : 
    {
      "reliability": 2
    } 
  },
  { 
    "timeseriesId": "5d33771d-d87a-4635-9af9-3998744ae33f",
    "unixTimestamp": 1487162700000,
    "ingestUnixTimestamp": 1487188365866,
    "timestamp": "2017-02-15T12:45:00+00:00",
    "val": 27,
    "metric": "Raw",
    "customData" : 
    {
      "reliability": 1
    }
  },
  ...
]

Errors

Error Description
403 Forbidden

Response Body Parameters

Name Description Schema
timeseriesId Timeseries the TSElement belogs to string
metric Metric of the sample string
timestamp Timestamp of the sample string(date-time)
val Value of the sample object
unixTimestamp Unix timestamp of the sample integer(int64)
ingestUnixTimestamp Unix timestamp the sample was saved to the database integer(int64)
customData Application specific data can be stored here Dictionary<string,object>