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"
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_SbResponseBody
oleobject loo_JsonResponse
integer li_Total_count
integer li_Offset
integer li_Limit
integer i
integer li_Count_i
string ls_Type
string ls_Id
string ls_File_versionType
string ls_File_versionId
string ls_File_versionSha1
string ls_Sequence_id
string ls_Etag
string ls_Sha1
string ls_Name
string ls_By
string ls_Direction
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://api.box.com/2.0/folders/BOX_FOLDER_ID/items?limit=2&offset=0
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.box.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Rest.AddHeader("Authorization","Bearer BOX_ACCESS_TOKEN")
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestNoBodySb("GET","/2.0/folders/BOX_FOLDER_ID/items?limit=2&offset=0",loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_SbResponseBody
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.LoadSb(loo_SbResponseBody)
li_Total_count = loo_JsonResponse.IntOf("total_count")
li_Offset = loo_JsonResponse.IntOf("offset")
li_Limit = loo_JsonResponse.IntOf("limit")
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("entries")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_Type = loo_JsonResponse.StringOf("entries[i].type")
ls_Id = loo_JsonResponse.StringOf("entries[i].id")
ls_File_versionType = loo_JsonResponse.StringOf("entries[i].file_version.type")
ls_File_versionId = loo_JsonResponse.StringOf("entries[i].file_version.id")
ls_File_versionSha1 = loo_JsonResponse.StringOf("entries[i].file_version.sha1")
ls_Sequence_id = loo_JsonResponse.StringOf("entries[i].sequence_id")
ls_Etag = loo_JsonResponse.StringOf("entries[i].etag")
ls_Sha1 = loo_JsonResponse.StringOf("entries[i].sha1")
ls_Name = loo_JsonResponse.StringOf("entries[i].name")
i = i + 1
loop
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("order")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_By = loo_JsonResponse.StringOf("order[i].by")
ls_Direction = loo_JsonResponse.StringOf("order[i].direction")
i = i + 1
loop
destroy loo_Rest
destroy loo_SbResponseBody
destroy loo_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"
}
]
}