Gets all of the files, folders, or web links contained within a folder.
curl https://api.box.com/2.0/folders/BOX_FOLDER_ID/items?limit=2&offset=0 \
-H "Authorization: Bearer BOX_ACCESS_TOKEN"
load ./chilkat.dll
set rest [new_CkRest]
# URL: https://api.box.com/2.0/folders/BOX_FOLDER_ID/items?limit=2&offset=0
set bTls 1
set port 443
set bAutoReconnect 1
set success [CkRest_Connect $rest "api.box.com" $port $bTls $bAutoReconnect]
if {[expr $success != 1]} then {
puts "ConnectFailReason: [CkRest_ConnectFailReason $rest]"
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
exit
}
CkRest_AddHeader $rest "Authorization" "Bearer BOX_ACCESS_TOKEN"
set sbResponseBody [new_CkStringBuilder]
set success [CkRest_FullRequestNoBodySb $rest "GET" "/2.0/folders/BOX_FOLDER_ID/items?limit=2&offset=0" $sbResponseBody]
if {[expr $success != 1]} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
exit
}
set jsonResponse [new_CkJsonObject]
CkJsonObject_LoadSb $jsonResponse $sbResponseBody
set total_count [CkJsonObject_IntOf $jsonResponse "total_count"]
set offset [CkJsonObject_IntOf $jsonResponse "offset"]
set limit [CkJsonObject_IntOf $jsonResponse "limit"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jsonResponse "entries"]
while {[expr $i < $count_i]} {
CkJsonObject_put_I $jsonResponse $i
set type [CkJsonObject_stringOf $jsonResponse "entries[i].type"]
set id [CkJsonObject_stringOf $jsonResponse "entries[i].id"]
set file_versionType [CkJsonObject_stringOf $jsonResponse "entries[i].file_version.type"]
set file_versionId [CkJsonObject_stringOf $jsonResponse "entries[i].file_version.id"]
set file_versionSha1 [CkJsonObject_stringOf $jsonResponse "entries[i].file_version.sha1"]
set sequence_id [CkJsonObject_stringOf $jsonResponse "entries[i].sequence_id"]
set etag [CkJsonObject_stringOf $jsonResponse "entries[i].etag"]
set sha1 [CkJsonObject_stringOf $jsonResponse "entries[i].sha1"]
set name [CkJsonObject_stringOf $jsonResponse "entries[i].name"]
set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jsonResponse "order"]
while {[expr $i < $count_i]} {
CkJsonObject_put_I $jsonResponse $i
set by [CkJsonObject_stringOf $jsonResponse "order[i].by"]
set direction [CkJsonObject_stringOf $jsonResponse "order[i].direction"]
set i [expr $i + 1]
}
delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jsonResponse
{
"total_count": 2,
"entries": [
{
"type": "file",
"id": "246181882790",
"file_version": {
"type": "file_version",
"id": "259636211878",
"sha1": "c9d2492fb97f88a9b4d1e35f32a3410e95853f18"
},
"sequence_id": "0",
"etag": "0",
"sha1": "c9d2492fb97f88a9b4d1e35f32a3410e95853f18",
"name": "hedgehogs.jpg"
},
{
"type": "file",
"id": "246167973161",
"file_version": {
"type": "file_version",
"id": "259621592361",
"sha1": "df7be9dc4f467187783aca68c7ce98e4df2172d0"
},
"sequence_id": "0",
"etag": "0",
"sha1": "df7be9dc4f467187783aca68c7ce98e4df2172d0",
"name": "penguins.jpg"
}
],
"offset": 0,
"limit": 2,
"order": [
{
"by": "type",
"direction": "ASC"
},
{
"by": "name",
"direction": "ASC"
}
]
}