DataFlex / Cognite API v1 / Search sequences
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vJson
Handle hoJson
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// 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
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "filter.name" "commodo non nulla aute" To iSuccess
Get ComUpdateString Of hoJson "filter.externalIdPrefix" "commodo qui cupidatat" To iSuccess
Get ComUpdateNewObject Of hoJson "filter.metadata" To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[0]" 4769293985777598 To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[1]" 5785768360784284 To iSuccess
Get ComUpdateInt Of hoJson "filter.rootAssetIds[0]" 1096264439313816 To iSuccess
Get ComUpdateInt Of hoJson "filter.rootAssetIds[1]" 4922424346728832 To iSuccess
Get ComUpdateString Of hoJson "filter.assetSubtreeIds[0].externalId" "exercitation pariatur id in" To iSuccess
Get ComUpdateInt Of hoJson "filter.assetSubtreeIds[1].id" 123 To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.max" 14384577 To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.min" 60974975 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.max" 83207483 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.min" 43920599 To iSuccess
Get ComUpdateString Of hoJson "filter.dataSetIds[0].externalId" "voluptate e" To iSuccess
Get ComUpdateString Of hoJson "filter.dataSetIds[1].externalId" "laboris" To iSuccess
Get ComUpdateString Of hoJson "search.name" "non culpa irure velit consequat" To iSuccess
Get ComUpdateString Of hoJson "search.description" "id eiusmod" To iSuccess
Get ComUpdateString Of hoJson "search.query" "ad" To iSuccess
Get ComUpdateInt Of hoJson "limit" 100 To iSuccess
Send ComSetRequestHeader To hoHttp "content-type" "application/json"
Send ComSetRequestHeader To hoHttp "api-key" "{{api-key}}"
Get pvComObject of hoJson to vJson
Get ComPostJson3 Of hoHttp "https://domain.com/api/v1/projects/{{project}}/sequences/search" "application/json" vJson To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln iTemp1
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
Send Destroy of hoResp
End_Procedure
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}"
}
}
}