unicodeC / Cognite API v1 / Search sequences
Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW json;
HCkHttpResponseW resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// 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": "commodo non nulla aute",
// "externalIdPrefix": "commodo qui cupidatat",
// "metadata": {},
// "assetIds": [
// 4769293985777598,
// 5785768360784284
// ],
// "rootAssetIds": [
// 1096264439313816,
// 4922424346728832
// ],
// "assetSubtreeIds": [
// {
// "externalId": "exercitation pariatur id in"
// },
// {
// "id": 22443661565144
// }
// ],
// "createdTime": {
// "max": 14384577,
// "min": 60974975
// },
// "lastUpdatedTime": {
// "max": 83207483,
// "min": 43920599
// },
// "dataSetIds": [
// {
// "externalId": "voluptate e"
// },
// {
// "externalId": "laboris"
// }
// ]
// },
// "search": {
// "name": "non culpa irure velit consequat",
// "description": "id eiusmod",
// "query": "ad"
// },
// "limit": 100
// }
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"filter.name",L"commodo non nulla aute");
CkJsonObjectW_UpdateString(json,L"filter.externalIdPrefix",L"commodo qui cupidatat");
CkJsonObjectW_UpdateNewObject(json,L"filter.metadata");
CkJsonObjectW_UpdateInt(json,L"filter.assetIds[0]",4769293985777598);
CkJsonObjectW_UpdateInt(json,L"filter.assetIds[1]",5785768360784284);
CkJsonObjectW_UpdateInt(json,L"filter.rootAssetIds[0]",1096264439313816);
CkJsonObjectW_UpdateInt(json,L"filter.rootAssetIds[1]",4922424346728832);
CkJsonObjectW_UpdateString(json,L"filter.assetSubtreeIds[0].externalId",L"exercitation pariatur id in");
CkJsonObjectW_UpdateInt(json,L"filter.assetSubtreeIds[1].id",123);
CkJsonObjectW_UpdateInt(json,L"filter.createdTime.max",14384577);
CkJsonObjectW_UpdateInt(json,L"filter.createdTime.min",60974975);
CkJsonObjectW_UpdateInt(json,L"filter.lastUpdatedTime.max",83207483);
CkJsonObjectW_UpdateInt(json,L"filter.lastUpdatedTime.min",43920599);
CkJsonObjectW_UpdateString(json,L"filter.dataSetIds[0].externalId",L"voluptate e");
CkJsonObjectW_UpdateString(json,L"filter.dataSetIds[1].externalId",L"laboris");
CkJsonObjectW_UpdateString(json,L"search.name",L"non culpa irure velit consequat");
CkJsonObjectW_UpdateString(json,L"search.description",L"id eiusmod");
CkJsonObjectW_UpdateString(json,L"search.query",L"ad");
CkJsonObjectW_UpdateInt(json,L"limit",100);
CkHttpW_SetRequestHeader(http,L"content-type",L"application/json");
CkHttpW_SetRequestHeader(http,L"api-key",L"{{api-key}}");
resp = CkHttpW_PostJson3(http,L"https://domain.com/api/v1/projects/{{project}}/sequences/search",L"application/json",json);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
}
Curl Command
curl -X POST
-H "api-key: {{api-key}}"
-H "content-type: application/json"
-d '{
"filter": {
"name": "commodo non nulla aute",
"externalIdPrefix": "commodo qui cupidatat",
"metadata": {},
"assetIds": [
4769293985777598,
5785768360784284
],
"rootAssetIds": [
1096264439313816,
4922424346728832
],
"assetSubtreeIds": [
{
"externalId": "exercitation pariatur id in"
},
{
"id": 22443661565144
}
],
"createdTime": {
"max": 14384577,
"min": 60974975
},
"lastUpdatedTime": {
"max": 83207483,
"min": 43920599
},
"dataSetIds": [
{
"externalId": "voluptate e"
},
{
"externalId": "laboris"
}
]
},
"search": {
"name": "non culpa irure velit consequat",
"description": "id eiusmod",
"query": "ad"
},
"limit": 100
}'
https://domain.com/api/v1/projects/{{project}}/sequences/search
Postman Collection Item JSON
{
"id": "searchSequences",
"name": "Search sequences",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"sequences",
"search"
],
"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 sequences matching the given criteria. This operation does not support pagination.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"name\": \"commodo non nulla aute\",\n \"externalIdPrefix\": \"commodo qui cupidatat\",\n \"metadata\": {},\n \"assetIds\": [\n 4769293985777598,\n 5785768360784284\n ],\n \"rootAssetIds\": [\n 1096264439313816,\n 4922424346728832\n ],\n \"assetSubtreeIds\": [\n {\n \"externalId\": \"exercitation pariatur id in\"\n },\n {\n \"id\": 22443661565144\n }\n ],\n \"createdTime\": {\n \"max\": 14384577,\n \"min\": 60974975\n },\n \"lastUpdatedTime\": {\n \"max\": 83207483,\n \"min\": 43920599\n },\n \"dataSetIds\": [\n {\n \"externalId\": \"voluptate e\"\n },\n {\n \"externalId\": \"laboris\"\n }\n ]\n },\n \"search\": {\n \"name\": \"non culpa irure velit consequat\",\n \"description\": \"id eiusmod\",\n \"query\": \"ad\"\n },\n \"limit\": 100\n}"
}
}
}