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": "labore",
// "directoryPrefix": "non",
// "mimeType": "amet",
// "metadata": {},
// "assetIds": [
// 2806482587450292,
// 5885270784918610
// ],
// "assetExternalIds": [
// "cillum quis laborum eu in",
// "pariatur aute incididunt minim nulla"
// ],
// "rootAssetIds": [
// {
// "id": 3434712602792354
// },
// {
// "externalId": "dolor nostrud sint tempor"
// }
// ],
// "dataSetIds": [
// {
// "id": 6643919081009120
// },
// {
// "externalId": "incidid"
// }
// ],
// "assetSubtreeIds": [
// {
// "id": 1381446255269154
// },
// {
// "id": 6877534894841850
// }
// ],
// "source": "in ullamco in qu",
// "createdTime": {
// "max": 52776204,
// "min": 19590899
// },
// "lastUpdatedTime": {
// "max": 2447871,
// "min": 62024320
// },
// "uploadedTime": {
// "max": 88446108,
// "min": 12715733
// },
// "sourceCreatedTime": {
// "max": 6470658,
// "min": 75552038
// },
// "sourceModifiedTime": {
// "max": 56421116,
// "min": 98065077
// },
// "externalIdPrefix": "incididunt occaecat eiusmod ut",
// "uploaded": true,
// "labels": {
// "containsAll": [
// {
// "externalId": "pariatur"
// },
// {
// "externalId": "adipisicing occaecat"
// }
// ]
// },
// "geoLocation": {
// "relation": "INTERSECTS",
// "shape": {
// "type": "Point",
// "coordinates": [
// -28013106.93372789,
// 67047806.90769461
// ]
// }
// }
// },
// "search": {
// "name": "qui"
// }
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "filter.name" "labore" To iSuccess
Get ComUpdateString Of hoJson "filter.directoryPrefix" "non" To iSuccess
Get ComUpdateString Of hoJson "filter.mimeType" "amet" To iSuccess
Get ComUpdateNewObject Of hoJson "filter.metadata" To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[0]" 2806482587450292 To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[1]" 5885270784918610 To iSuccess
Get ComUpdateString Of hoJson "filter.assetExternalIds[0]" "cillum quis laborum eu in" To iSuccess
Get ComUpdateString Of hoJson "filter.assetExternalIds[1]" "pariatur aute incididunt minim nulla" To iSuccess
Get ComUpdateInt Of hoJson "filter.rootAssetIds[0].id" 123 To iSuccess
Get ComUpdateString Of hoJson "filter.rootAssetIds[1].externalId" "dolor nostrud sint tempor" To iSuccess
Get ComUpdateInt Of hoJson "filter.dataSetIds[0].id" 123 To iSuccess
Get ComUpdateString Of hoJson "filter.dataSetIds[1].externalId" "incidid" To iSuccess
Get ComUpdateInt Of hoJson "filter.assetSubtreeIds[0].id" 123 To iSuccess
Get ComUpdateInt Of hoJson "filter.assetSubtreeIds[1].id" 123 To iSuccess
Get ComUpdateString Of hoJson "filter.source" "in ullamco in qu" To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.max" 52776204 To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.min" 19590899 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.max" 2447871 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.min" 62024320 To iSuccess
Get ComUpdateInt Of hoJson "filter.uploadedTime.max" 88446108 To iSuccess
Get ComUpdateInt Of hoJson "filter.uploadedTime.min" 12715733 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceCreatedTime.max" 6470658 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceCreatedTime.min" 75552038 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceModifiedTime.max" 56421116 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceModifiedTime.min" 98065077 To iSuccess
Get ComUpdateString Of hoJson "filter.externalIdPrefix" "incididunt occaecat eiusmod ut" To iSuccess
Get ComUpdateBool Of hoJson "filter.uploaded" True To iSuccess
Get ComUpdateString Of hoJson "filter.labels.containsAll[0].externalId" "pariatur" To iSuccess
Get ComUpdateString Of hoJson "filter.labels.containsAll[1].externalId" "adipisicing occaecat" To iSuccess
Get ComUpdateString Of hoJson "filter.geoLocation.relation" "INTERSECTS" To iSuccess
Get ComUpdateString Of hoJson "filter.geoLocation.shape.type" "Point" To iSuccess
Get ComUpdateNumber Of hoJson "filter.geoLocation.shape.coordinates[0]" "-28013106.93372789" To iSuccess
Get ComUpdateNumber Of hoJson "filter.geoLocation.shape.coordinates[1]" "67047806.90769461" To iSuccess
Get ComUpdateString Of hoJson "search.name" "qui" 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}}/files/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": "labore",
"directoryPrefix": "non",
"mimeType": "amet",
"metadata": {},
"assetIds": [
2806482587450292,
5885270784918610
],
"assetExternalIds": [
"cillum quis laborum eu in",
"pariatur aute incididunt minim nulla"
],
"rootAssetIds": [
{
"id": 3434712602792354
},
{
"externalId": "dolor nostrud sint tempor"
}
],
"dataSetIds": [
{
"id": 6643919081009120
},
{
"externalId": "incidid"
}
],
"assetSubtreeIds": [
{
"id": 1381446255269154
},
{
"id": 6877534894841850
}
],
"source": "in ullamco in qu",
"createdTime": {
"max": 52776204,
"min": 19590899
},
"lastUpdatedTime": {
"max": 2447871,
"min": 62024320
},
"uploadedTime": {
"max": 88446108,
"min": 12715733
},
"sourceCreatedTime": {
"max": 6470658,
"min": 75552038
},
"sourceModifiedTime": {
"max": 56421116,
"min": 98065077
},
"externalIdPrefix": "incididunt occaecat eiusmod ut",
"uploaded": true,
"labels": {
"containsAll": [
{
"externalId": "pariatur"
},
{
"externalId": "adipisicing occaecat"
}
]
},
"geoLocation": {
"relation": "INTERSECTS",
"shape": {
"type": "Point",
"coordinates": [
-28013106.93372789,
67047806.90769461
]
}
}
},
"search": {
"name": "qui"
}
}'
https://domain.com/api/v1/projects/{{project}}/files/search
Postman Collection Item JSON
{
"id": "searchFiles",
"name": "Search files",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"files",
"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": "Search for files based on relevance. You can also supply a strict match filter as in Filter files, and search in the results from the filter. Returns first 1000 results based on relevance. This operation does not support pagination.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"name\": \"labore\",\n \"directoryPrefix\": \"non\",\n \"mimeType\": \"amet\",\n \"metadata\": {},\n \"assetIds\": [\n 2806482587450292,\n 5885270784918610\n ],\n \"assetExternalIds\": [\n \"cillum quis laborum eu in\",\n \"pariatur aute incididunt minim nulla\"\n ],\n \"rootAssetIds\": [\n {\n \"id\": 3434712602792354\n },\n {\n \"externalId\": \"dolor nostrud sint tempor\"\n }\n ],\n \"dataSetIds\": [\n {\n \"id\": 6643919081009120\n },\n {\n \"externalId\": \"incidid\"\n }\n ],\n \"assetSubtreeIds\": [\n {\n \"id\": 1381446255269154\n },\n {\n \"id\": 6877534894841850\n }\n ],\n \"source\": \"in ullamco in qu\",\n \"createdTime\": {\n \"max\": 52776204,\n \"min\": 19590899\n },\n \"lastUpdatedTime\": {\n \"max\": 2447871,\n \"min\": 62024320\n },\n \"uploadedTime\": {\n \"max\": 88446108,\n \"min\": 12715733\n },\n \"sourceCreatedTime\": {\n \"max\": 6470658,\n \"min\": 75552038\n },\n \"sourceModifiedTime\": {\n \"max\": 56421116,\n \"min\": 98065077\n },\n \"externalIdPrefix\": \"incididunt occaecat eiusmod ut\",\n \"uploaded\": true,\n \"labels\": {\n \"containsAll\": [\n {\n \"externalId\": \"pariatur\"\n },\n {\n \"externalId\": \"adipisicing occaecat\"\n }\n ]\n },\n \"geoLocation\": {\n \"relation\": \"INTERSECTS\",\n \"shape\": {\n \"type\": \"Point\",\n \"coordinates\": [\n -28013106.93372789,\n 67047806.90769461\n ]\n }\n }\n },\n \"search\": {\n \"name\": \"qui\"\n }\n}"
}
}
}