PowerBuilder / Cognite API v1 / Filter time series
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "filter": {
// "name": "consectetur reprehenderit",
// "unit": "voluptate occaecat ut dolor ",
// "isString": true,
// "isStep": false,
// "metadata": {},
// "assetIds": [
// 2509118978120224,
// 7226404981552392
// ],
// "assetExternalIds": [
// "est laborum",
// "in in et aliquip"
// ],
// "rootAssetIds": [
// 6708483845679534,
// 3834273847268414
// ],
// "assetSubtreeIds": [
// {
// "id": 4838322974326730
// },
// {
// "externalId": "nisi Excepteur exercitation nulla reprehenderit"
// }
// ],
// "dataSetIds": [
// {
// "externalId": "Ut ex consectetur"
// },
// {
// "id": 8956424920459844
// }
// ],
// "externalIdPrefix": "reprehenderit fugiat pariatur id culpa",
// "createdTime": {
// "max": 82460819,
// "min": 76400255
// },
// "lastUpdatedTime": {
// "max": 24839160,
// "min": 94565958
// }
// },
// "limit": 100,
// "cursor": "pariatur quis eu anim",
// "partition": "do amet consectetur ad f"
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("filter.name","consectetur reprehenderit")
loo_Json.UpdateString("filter.unit","voluptate occaecat ut dolor ")
loo_Json.UpdateBool("filter.isString",1)
loo_Json.UpdateBool("filter.isStep",0)
loo_Json.UpdateNewObject("filter.metadata")
loo_Json.UpdateInt("filter.assetIds[0]",2509118978120224)
loo_Json.UpdateInt("filter.assetIds[1]",7226404981552392)
loo_Json.UpdateString("filter.assetExternalIds[0]","est laborum")
loo_Json.UpdateString("filter.assetExternalIds[1]","in in et aliquip")
loo_Json.UpdateInt("filter.rootAssetIds[0]",6708483845679534)
loo_Json.UpdateInt("filter.rootAssetIds[1]",3834273847268414)
loo_Json.UpdateInt("filter.assetSubtreeIds[0].id",123)
loo_Json.UpdateString("filter.assetSubtreeIds[1].externalId","nisi Excepteur exercitation nulla reprehenderit")
loo_Json.UpdateString("filter.dataSetIds[0].externalId","Ut ex consectetur")
loo_Json.UpdateInt("filter.dataSetIds[1].id",123)
loo_Json.UpdateString("filter.externalIdPrefix","reprehenderit fugiat pariatur id culpa")
loo_Json.UpdateInt("filter.createdTime.max",82460819)
loo_Json.UpdateInt("filter.createdTime.min",76400255)
loo_Json.UpdateInt("filter.lastUpdatedTime.max",24839160)
loo_Json.UpdateInt("filter.lastUpdatedTime.min",94565958)
loo_Json.UpdateInt("limit",100)
loo_Json.UpdateString("cursor","pariatur quis eu anim")
loo_Json.UpdateString("partition","do amet consectetur ad f")
loo_Http.SetRequestHeader("content-type","application/json")
loo_Http.SetRequestHeader("api-key","{{api-key}}")
loo_Resp = loo_Http.PostJson3("https://domain.com/api/v1/projects/{{project}}/timeseries/list","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
Curl Command
curl -X POST
-H "api-key: {{api-key}}"
-H "content-type: application/json"
-d '{
"filter": {
"name": "consectetur reprehenderit",
"unit": "voluptate occaecat ut dolor ",
"isString": true,
"isStep": false,
"metadata": {},
"assetIds": [
2509118978120224,
7226404981552392
],
"assetExternalIds": [
"est laborum",
"in in et aliquip"
],
"rootAssetIds": [
6708483845679534,
3834273847268414
],
"assetSubtreeIds": [
{
"id": 4838322974326730
},
{
"externalId": "nisi Excepteur exercitation nulla reprehenderit"
}
],
"dataSetIds": [
{
"externalId": "Ut ex consectetur"
},
{
"id": 8956424920459844
}
],
"externalIdPrefix": "reprehenderit fugiat pariatur id culpa",
"createdTime": {
"max": 82460819,
"min": 76400255
},
"lastUpdatedTime": {
"max": 24839160,
"min": 94565958
}
},
"limit": 100,
"cursor": "pariatur quis eu anim",
"partition": "do amet consectetur ad f"
}'
https://domain.com/api/v1/projects/{{project}}/timeseries/list
Postman Collection Item JSON
{
"id": "listTimeSeries",
"name": "Filter time series",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"timeseries",
"list"
],
"query": [
],
"variable": [
]
},
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{api-key}}",
"description": "An admin can create API keys in the Cognite console."
},
{
"key": "content-type",
"value": "application/json"
}
],
"description": "Retrieves a list of time series matching the specified criteria. This operation supports pagination by cursor. Criteria can be applied to select a subset of time series.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"name\": \"consectetur reprehenderit\",\n \"unit\": \"voluptate occaecat ut dolor \",\n \"isString\": true,\n \"isStep\": false,\n \"metadata\": {},\n \"assetIds\": [\n 2509118978120224,\n 7226404981552392\n ],\n \"assetExternalIds\": [\n \"est laborum\",\n \"in in et aliquip\"\n ],\n \"rootAssetIds\": [\n 6708483845679534,\n 3834273847268414\n ],\n \"assetSubtreeIds\": [\n {\n \"id\": 4838322974326730\n },\n {\n \"externalId\": \"nisi Excepteur exercitation nulla reprehenderit\"\n }\n ],\n \"dataSetIds\": [\n {\n \"externalId\": \"Ut ex consectetur\"\n },\n {\n \"id\": 8956424920459844\n }\n ],\n \"externalIdPrefix\": \"reprehenderit fugiat pariatur id culpa\",\n \"createdTime\": {\n \"max\": 82460819,\n \"min\": 76400255\n },\n \"lastUpdatedTime\": {\n \"max\": 24839160,\n \"min\": 94565958\n }\n },\n \"limit\": 100,\n \"cursor\": \"pariatur quis eu anim\",\n \"partition\": \"do amet consectetur ad f\"\n}"
}
}
}