Chilkat Online Tools

delphiDll / Cognite API v1 / Filter transformations

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
resp: HCkHttpResponse;

begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

http := CkHttp_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 := CkJsonObject_Create();
CkJsonObject_UpdateBool(json,'filter.isPublic',True);
CkJsonObject_UpdateString(json,'filter.nameRegex','voluptate irure aute');
CkJsonObject_UpdateString(json,'filter.queryRegex','fugiat dolor');
CkJsonObject_UpdateString(json,'filter.destinationType','dolore velit irure dolor');
CkJsonObject_UpdateString(json,'filter.conflictMode','id officia labore nostrud dolor');
CkJsonObject_UpdateBool(json,'filter.hasBlockedError',False);
CkJsonObject_UpdateString(json,'filter.cdfProjectName','in Ut');
CkJsonObject_UpdateInt(json,'filter.createdTime.min',47433915);
CkJsonObject_UpdateInt(json,'filter.createdTime.max',13086787);
CkJsonObject_UpdateInt(json,'filter.lastUpdatedTime.min',36390643);
CkJsonObject_UpdateInt(json,'filter.lastUpdatedTime.max',-75267076);
CkJsonObject_UpdateInt(json,'limit',-29037401);
CkJsonObject_UpdateString(json,'cursor','aute magna');

CkHttp_SetRequestHeader(http,'content-type','application/json');
CkHttp_SetRequestHeader(http,'api-key','{{api-key}}');

resp := CkHttp_PostJson3(http,'https://domain.com/api/v1/projects/{{project}}/transformations/filter','application/json',json);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add(IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
CkHttpResponse_Dispose(resp);

CkHttp_Dispose(http);
CkJsonObject_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}"
    }
  }
}