const timeseries = await client.timeseries.retrieve([
{ id: 123 },
{ externalId: 'abc' }
]);res = client.time_series.retrieve(id=1)
res = client.time_series.retrieve(external_id="1")
res = client.time_series.retrieve_multiple(ids=[1, 2, 3])
res = client.time_series.retrieve_multiple(external_ids=["abc", "def"])List<Item> byExternalIds = List.of(Item.newBuilder().setExternalId("10").build());
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(byExternalIds);// by list of items
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve("10", "20");// by varargs of String
List<Item> byInternalIds = List.of(Item.newBuilder().setId(10).build());
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(byInternalIds);// by list of items
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(10, 20);// by varargs of Longcurl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"id": 4503599627370496
}
],
"ignoreUnknownIds": false
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'id' => 4503599627370496
]
],
'ignoreUnknownIds' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": 4503599627370496\n }\n ],\n \"ignoreUnknownIds\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"id\": 4503599627370496\n }\n ],\n \"ignoreUnknownIds\": false\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 4503599627370496,
"isString": true,
"type": "<string>",
"isStep": true,
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"externalId": "<string>",
"instanceId": {
"space": "<string>",
"externalId": "<string>"
},
"name": "<string>",
"metadata": {},
"unit": "<string>",
"unitExternalId": "<string>",
"assetId": 4503599627370496,
"description": "<string>",
"securityCategories": [
123
],
"dataSetId": 4503599627370496
}
]
}{
"error": {
"code": 400,
"message": "<string>",
"missing": [
{
"id": 4503599627370496
}
]
}
}{
"error": {
"code": 422,
"message": "<string>",
"duplicated": [
{
"id": 4503599627370496
}
]
}
}Retrieve time series
Required capabilities:
timeSeriesAcl:READ
Retrieves one or more time series by ID or external ID. The response returns the time series in the same order as in the request.
const timeseries = await client.timeseries.retrieve([
{ id: 123 },
{ externalId: 'abc' }
]);res = client.time_series.retrieve(id=1)
res = client.time_series.retrieve(external_id="1")
res = client.time_series.retrieve_multiple(ids=[1, 2, 3])
res = client.time_series.retrieve_multiple(external_ids=["abc", "def"])List<Item> byExternalIds = List.of(Item.newBuilder().setExternalId("10").build());
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(byExternalIds);// by list of items
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve("10", "20");// by varargs of String
List<Item> byInternalIds = List.of(Item.newBuilder().setId(10).build());
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(byInternalIds);// by list of items
List<TimeseriesMetadata> retrievedAssets = client.timeseries().retrieve(10, 20);// by varargs of Longcurl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"id": 4503599627370496
}
],
"ignoreUnknownIds": false
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'id' => 4503599627370496
]
],
'ignoreUnknownIds' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids"
payload := strings.NewReader("{\n \"items\": [\n {\n \"id\": 4503599627370496\n }\n ],\n \"ignoreUnknownIds\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://{cluster}.cognitedata.com/api/v1/projects/{project}/timeseries/byids")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"id\": 4503599627370496\n }\n ],\n \"ignoreUnknownIds\": false\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 4503599627370496,
"isString": true,
"type": "<string>",
"isStep": true,
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"externalId": "<string>",
"instanceId": {
"space": "<string>",
"externalId": "<string>"
},
"name": "<string>",
"metadata": {},
"unit": "<string>",
"unitExternalId": "<string>",
"assetId": 4503599627370496,
"description": "<string>",
"securityCategories": [
123
],
"dataSetId": 4503599627370496
}
]
}{
"error": {
"code": 400,
"message": "<string>",
"missing": [
{
"id": 4503599627370496
}
]
}
}{
"error": {
"code": 422,
"message": "<string>",
"duplicated": [
{
"id": 4503599627370496
}
]
}
}Authorizations
Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
Body
List of the IDs of the time series to retrieve.
List of ID objects.
1 - 1000 elements- QueryWithInternalId
- QueryWithExternalId
- QueryWithInstanceId
Show child attributes
Show child attributes
Ignore IDs and external IDs that are not found
Response
Response with a list of time series matching the IDs.
List of responses. The order matches the requests order.
Show child attributes
Show child attributes
Was this page helpful?