In this article
Post Samples to a Timeseries ID
This endpoint is used to post samples to a single timeseries ID. A list of samples are provided in the body of the POST request. If you post more than 500 samples, it results in multiple psrIds in the returned response. There is a mechanism that breaks up the post requests into chunks of 500 samples at a time.
URL
https://{{HOST}}/timeseries/timeseries/{timeseries_id}/samples
Method
POST
Required IMS Scopes
- Read
- Write
Required ACL Permissions
- owner
- admin
- readwrite
Versions Supported
- 2.0 (Default)
- 2.1
URL Path Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| timeseries_id required |
Timeseries ID that the samples are posted to | GUID | string |
URL Query Parameters
| Name | Description | Example | Type |
|---|---|---|---|
| v optional |
Version of the API to use | v=2.0 | string |
Request Header Parameters
| Type | Value | Description |
|---|---|---|
| Authentication required |
Bearer {access_token} | Retrieve access token |
| Content-Type required |
application/json | |
| Content-Encoding optional |
gzip | Allows you to post the samples in a gzip format |
Request Body Parameters
| Name | Description | Schema |
|---|---|---|
| timeseriesId required |
Timeseries the TSElement belogs to | string |
| metric required |
Metric of the sample | string |
| timestamp required |
Timestamp of the sample | string(date-time) |
| val required |
Value of the sample | object |
| customData optional |
Application specific data can be stored here | Dictionary<string,object> |
Example
Request
curl -X POST
'https://{{HOST}}/timeseries/timeseries/0fd5dca2-8184-4394-a45f-276666198498/samples'
-H 'authorization: Bearer {access_token}'
-H 'cache-control: no-cache'
-H 'content-type: application/json'
-d '[
{ "timeseriesId": "0fd5dca2-8184-4394-a45f-276666198498", "val": 6, "timestamp": "2018-03-27T21:28:00+00:00", "metric": "Raw", "customData": {"reliability": 1}},
{ "timeseriesId": "0fd5dca2-8184-4394-a45f-276666198498", "val": 7, "timestamp": "2018-03-27T21:29:00+00:00", "metric": "Raw", "customData": {"reliability": "Low"}}
]
'
Response
{
"psrIds": [
"9f08190e-48f3-413a-bb3a-2d23a64b16a2"
]
}
| Error | Description |
|---|---|
| 403 | Forbidden |