Chilkat Online Tools

unicodeC / Cognite API v1 / Filter transformations

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": {
    //     "isPublic": true,
    //     "nameRegex": "voluptate irure aute",
    //     "queryRegex": "fugiat dolor",
    //     "destinationType": "dolore velit irure dolor",
    //     "conflictMode": "id officia labore nostrud dolor",
    //     "hasBlockedError": false,
    //     "cdfProjectName": "in Ut",
    //     "createdTime": {
    //       "min": 47433915,
    //       "max": 13086787
    //     },
    //     "lastUpdatedTime": {
    //       "min": 36390643,
    //       "max": -75267076
    //     }
    //   },
    //   "limit": -29037401,
    //   "cursor": "aute magna"
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateBool(json,L"filter.isPublic",TRUE);
    CkJsonObjectW_UpdateString(json,L"filter.nameRegex",L"voluptate irure aute");
    CkJsonObjectW_UpdateString(json,L"filter.queryRegex",L"fugiat dolor");
    CkJsonObjectW_UpdateString(json,L"filter.destinationType",L"dolore velit irure dolor");
    CkJsonObjectW_UpdateString(json,L"filter.conflictMode",L"id officia labore nostrud dolor");
    CkJsonObjectW_UpdateBool(json,L"filter.hasBlockedError",FALSE);
    CkJsonObjectW_UpdateString(json,L"filter.cdfProjectName",L"in Ut");
    CkJsonObjectW_UpdateInt(json,L"filter.createdTime.min",47433915);
    CkJsonObjectW_UpdateInt(json,L"filter.createdTime.max",13086787);
    CkJsonObjectW_UpdateInt(json,L"filter.lastUpdatedTime.min",36390643);
    CkJsonObjectW_UpdateInt(json,L"filter.lastUpdatedTime.max",-75267076);
    CkJsonObjectW_UpdateInt(json,L"limit",-29037401);
    CkJsonObjectW_UpdateString(json,L"cursor",L"aute magna");

    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}}/transformations/filter",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": {
        "isPublic": true,
        "nameRegex": "voluptate irure aute",
        "queryRegex": "fugiat dolor",
        "destinationType": "dolore velit irure dolor",
        "conflictMode": "id officia labore nostrud dolor",
        "hasBlockedError": false,
        "cdfProjectName": "in Ut",
        "createdTime": {
            "min": 47433915,
            "max": 13086787
        },
        "lastUpdatedTime": {
            "min": 36390643,
            "max": -75267076
        }
    },
    "limit": -29037401,
    "cursor": "aute magna"
}'
https://domain.com/api/v1/projects/{{project}}/transformations/filter

Postman Collection Item JSON

{
  "id": "filterTransformations",
  "name": "Filter transformations",
  "request": {
    "url": {
      "host": "{{baseUrl}}",
      "path": [
        "api",
        "v1",
        "projects",
        "{{project}}",
        "transformations",
        "filter"
      ],
      "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": "Filter transformations. Use nextCursor to paginate through the results.",
    "body": {
      "mode": "raw",
      "raw": "{\n    \"filter\": {\n        \"isPublic\": true,\n        \"nameRegex\": \"voluptate irure aute\",\n        \"queryRegex\": \"fugiat dolor\",\n        \"destinationType\": \"dolore velit irure dolor\",\n        \"conflictMode\": \"id officia labore nostrud dolor\",\n        \"hasBlockedError\": false,\n        \"cdfProjectName\": \"in Ut\",\n        \"createdTime\": {\n            \"min\": 47433915,\n            \"max\": 13086787\n        },\n        \"lastUpdatedTime\": {\n            \"min\": 36390643,\n            \"max\": -75267076\n        }\n    },\n    \"limit\": -29037401,\n    \"cursor\": \"aute magna\"\n}"
    }
  }
}