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": "ex nostrud consectetur",
// "directoryPrefix": "tempor laborum ad consectetur",
// "mimeType": "aute dolor sit Duis",
// "metadata": {},
// "assetIds": [
// 467579989120294,
// 8421974867540202
// ],
// "assetExternalIds": [
// "",
// "sint minim aliqua "
// ],
// "rootAssetIds": [
// {
// "id": 1543391847125216
// },
// {
// "id": 6483833221883084
// }
// ],
// "dataSetIds": [
// {
// "externalId": "eu aliqua dolor ea"
// },
// {
// "id": 954668826986822
// }
// ],
// "assetSubtreeIds": [
// {
// "externalId": "nisi occaecat sunt enim Ut"
// },
// {
// "externalId": "anim reprehenderit ex nostrud"
// }
// ],
// "source": "nulla mollit exercita",
// "createdTime": {
// "max": 35775661,
// "min": 68358871
// },
// "lastUpdatedTime": {
// "max": 39458190,
// "min": 53247476
// },
// "uploadedTime": {
// "max": 20009824,
// "min": 24281615
// },
// "sourceCreatedTime": {
// "max": 94237198,
// "min": 59856114
// },
// "sourceModifiedTime": {
// "max": 74319204,
// "min": 63072110
// },
// "externalIdPrefix": "et",
// "uploaded": false,
// "labels": {
// "containsAll": [
// {
// "externalId": "Ut ipsum in"
// },
// {
// "externalId": "amet reprehenderit velit"
// }
// ]
// },
// "geoLocation": {
// "relation": "WITHIN",
// "shape": {
// "type": "LineString",
// "coordinates": [
// ]
// }
// }
// },
// "partition": "proident est Duis nisi et",
// "limit": 100,
// "cursor": "incididunt"
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "filter.name" "ex nostrud consectetur" To iSuccess
Get ComUpdateString Of hoJson "filter.directoryPrefix" "tempor laborum ad consectetur" To iSuccess
Get ComUpdateString Of hoJson "filter.mimeType" "aute dolor sit Duis" To iSuccess
Get ComUpdateNewObject Of hoJson "filter.metadata" To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[0]" 467579989120294 To iSuccess
Get ComUpdateInt Of hoJson "filter.assetIds[1]" 8421974867540202 To iSuccess
Get ComUpdateString Of hoJson "filter.assetExternalIds[0]" "" To iSuccess
Get ComUpdateString Of hoJson "filter.assetExternalIds[1]" "sint minim aliqua " To iSuccess
Get ComUpdateInt Of hoJson "filter.rootAssetIds[0].id" 123 To iSuccess
Get ComUpdateInt Of hoJson "filter.rootAssetIds[1].id" 123 To iSuccess
Get ComUpdateString Of hoJson "filter.dataSetIds[0].externalId" "eu aliqua dolor ea" To iSuccess
Get ComUpdateInt Of hoJson "filter.dataSetIds[1].id" 123 To iSuccess
Get ComUpdateString Of hoJson "filter.assetSubtreeIds[0].externalId" "nisi occaecat sunt enim Ut" To iSuccess
Get ComUpdateString Of hoJson "filter.assetSubtreeIds[1].externalId" "anim reprehenderit ex nostrud" To iSuccess
Get ComUpdateString Of hoJson "filter.source" "nulla mollit exercita" To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.max" 35775661 To iSuccess
Get ComUpdateInt Of hoJson "filter.createdTime.min" 68358871 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.max" 39458190 To iSuccess
Get ComUpdateInt Of hoJson "filter.lastUpdatedTime.min" 53247476 To iSuccess
Get ComUpdateInt Of hoJson "filter.uploadedTime.max" 20009824 To iSuccess
Get ComUpdateInt Of hoJson "filter.uploadedTime.min" 24281615 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceCreatedTime.max" 94237198 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceCreatedTime.min" 59856114 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceModifiedTime.max" 74319204 To iSuccess
Get ComUpdateInt Of hoJson "filter.sourceModifiedTime.min" 63072110 To iSuccess
Get ComUpdateString Of hoJson "filter.externalIdPrefix" "et" To iSuccess
Get ComUpdateBool Of hoJson "filter.uploaded" False To iSuccess
Get ComUpdateString Of hoJson "filter.labels.containsAll[0].externalId" "Ut ipsum in" To iSuccess
Get ComUpdateString Of hoJson "filter.labels.containsAll[1].externalId" "amet reprehenderit velit" To iSuccess
Get ComUpdateString Of hoJson "filter.geoLocation.relation" "WITHIN" To iSuccess
Get ComUpdateString Of hoJson "filter.geoLocation.shape.type" "LineString" To iSuccess
Get ComUpdateNewArray Of hoJson "filter.geoLocation.shape.coordinates" To iSuccess
Get ComUpdateString Of hoJson "partition" "proident est Duis nisi et" To iSuccess
Get ComUpdateInt Of hoJson "limit" 100 To iSuccess
Get ComUpdateString Of hoJson "cursor" "incididunt" 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/list" "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": "ex nostrud consectetur",
"directoryPrefix": "tempor laborum ad consectetur",
"mimeType": "aute dolor sit Duis",
"metadata": {},
"assetIds": [
467579989120294,
8421974867540202
],
"assetExternalIds": [
"",
"sint minim aliqua "
],
"rootAssetIds": [
{
"id": 1543391847125216
},
{
"id": 6483833221883084
}
],
"dataSetIds": [
{
"externalId": "eu aliqua dolor ea"
},
{
"id": 954668826986822
}
],
"assetSubtreeIds": [
{
"externalId": "nisi occaecat sunt enim Ut"
},
{
"externalId": "anim reprehenderit ex nostrud"
}
],
"source": "nulla mollit exercita",
"createdTime": {
"max": 35775661,
"min": 68358871
},
"lastUpdatedTime": {
"max": 39458190,
"min": 53247476
},
"uploadedTime": {
"max": 20009824,
"min": 24281615
},
"sourceCreatedTime": {
"max": 94237198,
"min": 59856114
},
"sourceModifiedTime": {
"max": 74319204,
"min": 63072110
},
"externalIdPrefix": "et",
"uploaded": false,
"labels": {
"containsAll": [
{
"externalId": "Ut ipsum in"
},
{
"externalId": "amet reprehenderit velit"
}
]
},
"geoLocation": {
"relation": "WITHIN",
"shape": {
"type": "LineString",
"coordinates": []
}
}
},
"partition": "proident est Duis nisi et",
"limit": 100,
"cursor": "incididunt"
}'
https://domain.com/api/v1/projects/{{project}}/files/list
Postman Collection Item JSON
{
"id": "advancedListFiles",
"name": "Filter files",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"files",
"list"
],
"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 all files in a project. Criteria can be supplied to select a subset of files. This operation supports pagination with cursors.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"name\": \"ex nostrud consectetur\",\n \"directoryPrefix\": \"tempor laborum ad consectetur\",\n \"mimeType\": \"aute dolor sit Duis\",\n \"metadata\": {},\n \"assetIds\": [\n 467579989120294,\n 8421974867540202\n ],\n \"assetExternalIds\": [\n \"\",\n \"sint minim aliqua \"\n ],\n \"rootAssetIds\": [\n {\n \"id\": 1543391847125216\n },\n {\n \"id\": 6483833221883084\n }\n ],\n \"dataSetIds\": [\n {\n \"externalId\": \"eu aliqua dolor ea\"\n },\n {\n \"id\": 954668826986822\n }\n ],\n \"assetSubtreeIds\": [\n {\n \"externalId\": \"nisi occaecat sunt enim Ut\"\n },\n {\n \"externalId\": \"anim reprehenderit ex nostrud\"\n }\n ],\n \"source\": \"nulla mollit exercita\",\n \"createdTime\": {\n \"max\": 35775661,\n \"min\": 68358871\n },\n \"lastUpdatedTime\": {\n \"max\": 39458190,\n \"min\": 53247476\n },\n \"uploadedTime\": {\n \"max\": 20009824,\n \"min\": 24281615\n },\n \"sourceCreatedTime\": {\n \"max\": 94237198,\n \"min\": 59856114\n },\n \"sourceModifiedTime\": {\n \"max\": 74319204,\n \"min\": 63072110\n },\n \"externalIdPrefix\": \"et\",\n \"uploaded\": false,\n \"labels\": {\n \"containsAll\": [\n {\n \"externalId\": \"Ut ipsum in\"\n },\n {\n \"externalId\": \"amet reprehenderit velit\"\n }\n ]\n },\n \"geoLocation\": {\n \"relation\": \"WITHIN\",\n \"shape\": {\n \"type\": \"LineString\",\n \"coordinates\": []\n }\n }\n },\n \"partition\": \"proident est Duis nisi et\",\n \"limit\": 100,\n \"cursor\": \"incididunt\"\n}"
}
}
}