Chilkat Online Tools

Android / Cognite API v1 / Filter transformations

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    // 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"
    // }

    CkJsonObject json = new CkJsonObject();
    json.UpdateBool("filter.isPublic",true);
    json.UpdateString("filter.nameRegex","voluptate irure aute");
    json.UpdateString("filter.queryRegex","fugiat dolor");
    json.UpdateString("filter.destinationType","dolore velit irure dolor");
    json.UpdateString("filter.conflictMode","id officia labore nostrud dolor");
    json.UpdateBool("filter.hasBlockedError",false);
    json.UpdateString("filter.cdfProjectName","in Ut");
    json.UpdateInt("filter.createdTime.min",47433915);
    json.UpdateInt("filter.createdTime.max",13086787);
    json.UpdateInt("filter.lastUpdatedTime.min",36390643);
    json.UpdateInt("filter.lastUpdatedTime.max",-75267076);
    json.UpdateInt("limit",-29037401);
    json.UpdateString("cursor","aute magna");

    http.SetRequestHeader("content-type","application/json");
    http.SetRequestHeader("api-key","{{api-key}}");

    CkHttpResponse resp = http.PostJson3("https://domain.com/api/v1/projects/{{project}}/transformations/filter","application/json",json);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    Log.i(TAG, String.valueOf(resp.get_StatusCode()));
    Log.i(TAG, resp.bodyStr());


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

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}"
    }
  }
}