Gets the folder info for the root folder of a Box.com account. The root folder of a box.com account always has an id = "0".
curl https://api.box.com/2.0/folders/0 \
-H "Authorization: Bearer BOX_ACCESS_TOKEN" \
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Boolean iBTls
Integer iPort
Boolean iBAutoReconnect
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJsonResponse
String sType
String sId
Boolean iSequence_id
Boolean iEtag
String sName
Boolean iCreated_at
Boolean iModified_at
String sDescription
Integer iSize
Integer iPath_collectionTotal_count
String sCreated_byType
String sCreated_byId
String sCreated_byName
String sCreated_byLogin
String sModified_byType
String sModified_byId
String sModified_byName
String sModified_byLogin
Boolean iTrashed_at
Boolean iPurged_at
Boolean iContent_created_at
Boolean iContent_modified_at
String sOwned_byType
String sOwned_byId
String sOwned_byName
String sOwned_byLogin
Boolean iShared_link
Boolean iFolder_upload_email
Boolean iParent
String sItem_status
Integer iItem_collectionTotal_count
Integer iItem_collectionOffset
Integer iItem_collectionLimit
Integer i
Integer iCount_i
String sFile_versionType
String sFile_versionId
String sFile_versionSha1
String sSequence_id_str
String sEtag_str
String sSha1
String sBy
String sDirection
String sTemp1
Integer iTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// URL: https://api.box.com/2.0/folders/0
Move True To iBTls
Move 443 To iPort
Move True To iBAutoReconnect
Get ComConnect Of hoRest "api.box.com" iPort iBTls iBAutoReconnect To iSuccess
If (iSuccess <> True) Begin
Get ComConnectFailReason Of hoRest To iTemp1
Showln "ConnectFailReason: " iTemp1
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComAddHeader Of hoRest "Authorization" "Bearer BOX_ACCESS_TOKEN" To iSuccess
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComFullRequestNoBodySb Of hoRest "GET" "/2.0/folders/0" vSbResponseBody To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJsonResponse vSbResponseBody To iSuccess
Get ComStringOf Of hoJsonResponse "type" To sType
Get ComStringOf Of hoJsonResponse "id" To sId
Get ComIsNullOf Of hoJsonResponse "sequence_id" To iSequence_id
Get ComIsNullOf Of hoJsonResponse "etag" To iEtag
Get ComStringOf Of hoJsonResponse "name" To sName
Get ComIsNullOf Of hoJsonResponse "created_at" To iCreated_at
Get ComIsNullOf Of hoJsonResponse "modified_at" To iModified_at
Get ComStringOf Of hoJsonResponse "description" To sDescription
Get ComIntOf Of hoJsonResponse "size" To iSize
Get ComIntOf Of hoJsonResponse "path_collection.total_count" To iPath_collectionTotal_count
Get ComStringOf Of hoJsonResponse "created_by.type" To sCreated_byType
Get ComStringOf Of hoJsonResponse "created_by.id" To sCreated_byId
Get ComStringOf Of hoJsonResponse "created_by.name" To sCreated_byName
Get ComStringOf Of hoJsonResponse "created_by.login" To sCreated_byLogin
Get ComStringOf Of hoJsonResponse "modified_by.type" To sModified_byType
Get ComStringOf Of hoJsonResponse "modified_by.id" To sModified_byId
Get ComStringOf Of hoJsonResponse "modified_by.name" To sModified_byName
Get ComStringOf Of hoJsonResponse "modified_by.login" To sModified_byLogin
Get ComIsNullOf Of hoJsonResponse "trashed_at" To iTrashed_at
Get ComIsNullOf Of hoJsonResponse "purged_at" To iPurged_at
Get ComIsNullOf Of hoJsonResponse "content_created_at" To iContent_created_at
Get ComIsNullOf Of hoJsonResponse "content_modified_at" To iContent_modified_at
Get ComStringOf Of hoJsonResponse "owned_by.type" To sOwned_byType
Get ComStringOf Of hoJsonResponse "owned_by.id" To sOwned_byId
Get ComStringOf Of hoJsonResponse "owned_by.name" To sOwned_byName
Get ComStringOf Of hoJsonResponse "owned_by.login" To sOwned_byLogin
Get ComIsNullOf Of hoJsonResponse "shared_link" To iShared_link
Get ComIsNullOf Of hoJsonResponse "folder_upload_email" To iFolder_upload_email
Get ComIsNullOf Of hoJsonResponse "parent" To iParent
Get ComStringOf Of hoJsonResponse "item_status" To sItem_status
Get ComIntOf Of hoJsonResponse "item_collection.total_count" To iItem_collectionTotal_count
Get ComIntOf Of hoJsonResponse "item_collection.offset" To iItem_collectionOffset
Get ComIntOf Of hoJsonResponse "item_collection.limit" To iItem_collectionLimit
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "path_collection.entries" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "item_collection.entries" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].type" To sType
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].id" To sId
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].file_version.type" To sFile_versionType
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].file_version.id" To sFile_versionId
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].file_version.sha1" To sFile_versionSha1
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].sequence_id" To sSequence_id_str
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].etag" To sEtag_str
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].sha1" To sSha1
Get ComStringOf Of hoJsonResponse "item_collection.entries[i].name" To sName
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "item_collection.order" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "item_collection.order[i].by" To sBy
Get ComStringOf Of hoJsonResponse "item_collection.order[i].direction" To sDirection
Move i + 1 To i
Loop
End_Procedure
{
"type": "folder",
"id": "0",
"sequence_id": null,
"etag": null,
"name": "All Files",
"created_at": null,
"modified_at": null,
"description": "",
"size": 826408,
"path_collection": {
"total_count": 0,
"entries": [
]
},
"created_by": {
"type": "user",
"id": "",
"name": "",
"login": ""
},
"modified_by": {
"type": "user",
"id": "2787704945",
"name": "chilkat",
"login": "AutomationUser_434741_3nmGYSS7o5@@boxdevedition.com"
},
"trashed_at": null,
"purged_at": null,
"content_created_at": null,
"content_modified_at": null,
"owned_by": {
"type": "user",
"id": "2787704945",
"name": "chilkat",
"login": "AutomationUser_434741_3nmGYSS7o5@@boxdevedition.com"
},
"shared_link": null,
"folder_upload_email": null,
"parent": null,
"item_status": "active",
"item_collection": {
"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": 100,
"order": [
{
"by": "type",
"direction": "ASC"
},
{
"by": "name",
"direction": "ASC"
}
]
}
}