Chilkat Online Tools

PowerBuilder / Cognite API v1 / Search sequences

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.UpdateString("filter.name","commodo non nulla aute")
loo_Json.UpdateString("filter.externalIdPrefix","commodo qui cupidatat")
loo_Json.UpdateNewObject("filter.metadata")
loo_Json.UpdateInt("filter.assetIds[0]",4769293985777598)
loo_Json.UpdateInt("filter.assetIds[1]",5785768360784284)
loo_Json.UpdateInt("filter.rootAssetIds[0]",1096264439313816)
loo_Json.UpdateInt("filter.rootAssetIds[1]",4922424346728832)
loo_Json.UpdateString("filter.assetSubtreeIds[0].externalId","exercitation pariatur id in")
loo_Json.UpdateInt("filter.assetSubtreeIds[1].id",123)
loo_Json.UpdateInt("filter.createdTime.max",14384577)
loo_Json.UpdateInt("filter.createdTime.min",60974975)
loo_Json.UpdateInt("filter.lastUpdatedTime.max",83207483)
loo_Json.UpdateInt("filter.lastUpdatedTime.min",43920599)
loo_Json.UpdateString("filter.dataSetIds[0].externalId","voluptate e")
loo_Json.UpdateString("filter.dataSetIds[1].externalId","laboris")
loo_Json.UpdateString("search.name","non culpa irure velit consequat")
loo_Json.UpdateString("search.description","id eiusmod")
loo_Json.UpdateString("search.query","ad")
loo_Json.UpdateInt("limit",100)

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

loo_Resp = loo_Http.PostJson3("https://domain.com/api/v1/projects/{{project}}/sequences/search","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    return
end if

Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp


destroy loo_Http
destroy loo_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}"
    }
  }
}