In this article
Get Sample Statistics for a TimeseriesId(s)
Users of the Timeseries API can use this endpoint to get statistics of the samples related to a Timeseries ID
URL
https://{{HOST}}/timeseries/stats?timeseries_ids={timeseries_id_1}×eries_ids={timeseries_id_n}
Method
GET
Required IMS Scopes
- Read
- Write
Required ACL Permissions
- owner
- admin
- readwrite
- readonly
Versions Supported
- 2.0 (Default)
- 2.1
URL Query Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| v optional |
Version of the API to use | v=2.0 | string |
| timeseries_ids required |
Timeseries IDs for which to get statistics | GUID | 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) |
| stat optional |
stats A list of the stats to return. By default it returns first, last, count | Options include: Count, Average, Sum, Min, and Max | string |
Request Header Parameters
| Type | Value | Description |
|---|---|---|
| Authentication | Bearer {access_token} required |
Retrieve access token |
| Content-Type | application/json required |
Description |
Example
Request
curl -X GET
'https://{{HOST}}/timeseries/timeseries/cbd573df-a2ee-4de5-83e1-56127beb4702/stats?stat=avg,count,min,max,sum'
-H 'Authorization: Bearer {access_token}'
-H 'Cache-Control: no-cache'
-H 'Content-Type: application/json'
Response
[
{
"timeseriesId": "cbd573df-a2ee-4de5-83e1-56127beb4702",
"metric": "Raw",
"firstTimestamp": "2017-01-28T21:28:00+00:00",
"lastTimestamp": "2017-01-30T21:28:00+00:00",
"count": 3,
"avg": 2,
"min": 1,
"max": 3,
"sum": 6
}
]
Errors
| Error | Description |
|---|---|
| 403 | Forbidden |
Response Body Parameters
| Name | Description | Schema |
|---|---|---|
| timeseriesId | Timeseries Id | string |
| metric | Metric Name | string |
| firstTimestamp | First timestamp in time frame requested | ISO 8601 string(date-time + offset) |
| lastTimestamp | First timestamp in time frame requested | ISO 8601 string(date-time + offset) |
| count | Number of samples | double |
| avg | Average value of samples | double |
| min | Minimum value in time range | double |
| max | Maximum value in time range | double |