In this article
Add or Update Metrics
A metric is a series of operations that are applied to the timeseries data to produce meaningful insights about the data. Timeseries API supports aggregation, filtering, and arithmetic operations that can run on the timeseries data. Every operation must have input(s) and output(s) and a set of parameters required by the operation. For more information, refer to the documentation of supported operations on timeseries APIs for a detailed description of the operations. For a list of all supported operations, refer to the documentation.
- Frequency is limited to: PT15M, PT30M, PT1H, PT6H, PT12H, and PT24H
Consumes
application/jsontext/jsonapplication/json-patch+json
URL
https://{{HOST}}/timeseries/timeseries/{timeseries_id}/metrics
Method
POST
Required IMS Scopes
- Read
- Write
Required ACL Permissions
- owner
- admin
Versions Supported
- 2.0 (Default)
- 2.1
URL Path Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| id optional |
Id of Needed for the Endpoint | /endpoint/id | string |
| timeseriesId required |
Timeseries ID to add metrics to | GUID | string |
URL Query Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| v optional |
Version of the API to use | v=2.0 | string |
| withValidation optional |
Validates metric definition | true | boolean |
Request Header Parameters
| Type | Value | Description |
|---|---|---|
| Authentication | Bearer {access_token} required |
Retrieve access token |
| Content-Type | application/json required |
Description |
Request Body Parameters
| Name | Description | Type |
|---|---|---|
| metrics optional |
List of metrics to add | <xref:timeseriesDefinitions.md#metric> array |
Example
Request
curl -X POST
'https://{{HOST}}/timeseries/timeseries/920de700-8a84-4306-aef7-2676df222c6f/metrics'
-H 'Cache-Control: no-cache'
-H 'Content-Type: application/json'
-d '[
{
"metric": "QuarterHourlyAverage",
"operations": [
{
"operation": "Aggregate",
"input": [ {"timeseriesId":"920de700-8a84-4306-aef7-2676df222c6f", "metric":"Raw" } ],
"output": [ { "timeseriesId":"920de700-8a84-4306-aef7-2676df222c6f", "metric":"QuarterHourlyAverage" } ],
"parameters": { "function": "Average", "interval": "QuarterHourly" }
}
],
"processingType": "stream"
}
]'
Errors
| Error | Description |
|---|---|
| 403 | Forbidden |