Chilkat Online Tools

Swift3 / Cognite API v1 / Filter transformations

Back to Collection Items

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

    let http = CkoHttp()!
    var success: Bool

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

    let json = CkoJsonObject()!
    json.updateBool("filter.isPublic", value: true)
    json.update("filter.nameRegex", value: "voluptate irure aute")
    json.update("filter.queryRegex", value: "fugiat dolor")
    json.update("filter.destinationType", value: "dolore velit irure dolor")
    json.update("filter.conflictMode", value: "id officia labore nostrud dolor")
    json.updateBool("filter.hasBlockedError", value: false)
    json.update("filter.cdfProjectName", value: "in Ut")
    json.updateInt("filter.createdTime.min", value: 47433915)
    json.updateInt("filter.createdTime.max", value: 13086787)
    json.updateInt("filter.lastUpdatedTime.min", value: 36390643)
    json.updateInt("filter.lastUpdatedTime.max", value: -75267076)
    json.updateInt("limit", value: -29037401)
    json.update("cursor", value: "aute magna")

    http.setRequestHeader("content-type", value: "application/json")
    http.setRequestHeader("api-key", value: "{{api-key}}")

    var resp: CkoHttpResponse? = http.postJson3("https://domain.com/api/v1/projects/{{project}}/transformations/filter", contentType: "application/json", json: json)
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("\(resp!.statusCode.intValue)")
    print("\(resp!.bodyStr!)")
    resp = nil

}

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