PowerBuilder / Cognite API v1 / Aggregate data sets
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": {
// "metadata": {},
// "createdTime": {
// "max": 65995361,
// "min": 52623899
// },
// "lastUpdatedTime": {
// "max": 26357091,
// "min": 87850938
// },
// "externalIdPrefix": "reprehenderit",
// "writeProtected": false
// }
// }
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.UpdateNewObject("filter.metadata")
loo_Json.UpdateInt("filter.createdTime.max",65995361)
loo_Json.UpdateInt("filter.createdTime.min",52623899)
loo_Json.UpdateInt("filter.lastUpdatedTime.max",26357091)
loo_Json.UpdateInt("filter.lastUpdatedTime.min",87850938)
loo_Json.UpdateString("filter.externalIdPrefix","reprehenderit")
loo_Json.UpdateBool("filter.writeProtected",0)
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}}/datasets/aggregate","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": {
"metadata": {},
"createdTime": {
"max": 65995361,
"min": 52623899
},
"lastUpdatedTime": {
"max": 26357091,
"min": 87850938
},
"externalIdPrefix": "reprehenderit",
"writeProtected": false
}
}'
https://domain.com/api/v1/projects/{{project}}/datasets/aggregate
Postman Collection Item JSON
{
"id": "aggregateDataSets",
"name": "Aggregate data sets",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"datasets",
"aggregate"
],
"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": "Aggregate data sets in the same project. Criteria can be applied to select a subset of data sets.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"metadata\": {},\n \"createdTime\": {\n \"max\": 65995361,\n \"min\": 52623899\n },\n \"lastUpdatedTime\": {\n \"max\": 26357091,\n \"min\": 87850938\n },\n \"externalIdPrefix\": \"reprehenderit\",\n \"writeProtected\": false\n }\n}"
}
}
}