Starts returning the contents of a folder. If the result's ListFolderResult.has_more field is true, call list_folder/continue with the returned ListFolderResult.cursor to retrieve more entries.
curl -X POST https://api.dropboxapi.com/2/files/list_folder \
--header "Authorization: Bearer DROPBOX-ACCESS-TOKEN" \
--header "Content-Type: application/json" \
--data "{\"path\": \"/Homework/math\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false,\"include_mounted_folders\": true}"
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_JsonResponse
integer i
integer li_Count_i
string ls_Cursor
integer li_Has_more
string ls_Tag
string ls_Name
string ls_Path_lower
string ls_Path_display
string ls_Id
string ls_Client_modified
string ls_Server_modified
string ls_Rev
integer li_Size
string ls_Content_hash
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.dropboxapi.com/2/files/list_folder
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.dropboxapi.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
// See the Online Tool for Generating JSON Creation Code
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateString("path","/Homework/math")
loo_Json.UpdateBool("recursive",0)
loo_Json.UpdateBool("include_media_info",0)
loo_Json.UpdateBool("include_deleted",0)
loo_Json.UpdateBool("include_has_explicit_shared_members",0)
loo_Json.UpdateBool("include_mounted_folders",1)
loo_Rest.AddHeader("Authorization","Bearer DROPBOX-ACCESS-TOKEN")
loo_Rest.AddHeader("Content-Type","application/json")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("POST","/2/files/list_folder",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
if li_RespStatusCode >= 400 then
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
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)
// See the Online Tool for Generating JSON Parse Code
ls_Cursor = loo_JsonResponse.StringOf("cursor")
li_Has_more = loo_JsonResponse.BoolOf("has_more")
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("entries")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_Tag = loo_JsonResponse.StringOf("entries[i].\".tag\"")
ls_Name = loo_JsonResponse.StringOf("entries[i].name")
ls_Path_lower = loo_JsonResponse.StringOf("entries[i].path_lower")
ls_Path_display = loo_JsonResponse.StringOf("entries[i].path_display")
ls_Id = loo_JsonResponse.StringOf("entries[i].id")
ls_Client_modified = loo_JsonResponse.StringOf("entries[i].client_modified")
ls_Server_modified = loo_JsonResponse.StringOf("entries[i].server_modified")
ls_Rev = loo_JsonResponse.StringOf("entries[i].rev")
li_Size = loo_JsonResponse.IntOf("entries[i].size")
ls_Content_hash = loo_JsonResponse.StringOf("entries[i].content_hash")
i = i + 1
loop
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JsonResponse
{
"entries": [
{
".tag": "file",
"name": "Matrices.txt",
"path_lower": "/homework/math/matrices.txt",
"path_display": "/Homework/math/Matrices.txt",
"id": "id:qk7WwvROeSAAAAAAAAAAAQ",
"client_modified": "2016-06-02T20:41:02Z",
"server_modified": "2016-06-02T20:41:03Z",
"rev": "5482db15f",
"size": 6,
"content_hash": "5a3c776e2631edabe2ba710ac72301b3aeca821ba4f7d36b56cc6050ea6c2ba8"
},
{
".tag": "file",
"name": "Document.docx",
"path_lower": "/homework/math/document.docx",
"path_display": "/Homework/math/Document.docx",
"id": "id:JSXYsxHo1hAAAAAAAAAABw",
"client_modified": "2018-10-22T21:59:23Z",
"server_modified": "2018-10-22T21:59:23Z",
"rev": "10482db15f",
"size": 11009,
"content_hash": "ab9c1887a653a8f42e4401425ac02839e1f76533e1d44ac8d0605d870a16c25d"
}
],
"cursor": "AAHnmmjY1IztwebFmkByuZ_Vgzz-tSYXYE3KhdkUxBfETpGjPqTBz7ZzBj1G7zkPPVanKCt0FtzqXjDQ2ggQKYZTiL4mJ346fRelmP049QjN5CZzeMHbD_lSFqA96Br36vR9YLg40VAHu42TcCG38MbUPOCKa-wdguu5C1JsgYvIaXIcjRMCfbxz98JdYhhefmu0pjoxtgtCstOrmp_pXIng",
"has_more": false
}