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}"
LOCAL loRest
LOCAL lnSuccess
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
LOCAL loJsonResponse
LOCAL i
LOCAL lnCount_i
LOCAL lcCursor
LOCAL lnHas_more
LOCAL lcTag
LOCAL lcName
LOCAL lcPath_lower
LOCAL lcPath_display
LOCAL lcId
LOCAL lcClient_modified
LOCAL lcServer_modified
LOCAL lcRev
LOCAL lnSize
LOCAL lcContent_hash
loRest = CreateObject('Chilkat_9_5_0.Rest')
* URL: https://api.dropboxapi.com/2/files/list_folder
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("api.dropboxapi.com",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
* See the Online Tool for Generating JSON Creation Code
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("path","/Homework/math")
loJson.UpdateBool("recursive",0)
loJson.UpdateBool("include_media_info",0)
loJson.UpdateBool("include_deleted",0)
loJson.UpdateBool("include_has_explicit_shared_members",0)
loJson.UpdateBool("include_mounted_folders",1)
loRest.AddHeader("Authorization","Bearer DROPBOX-ACCESS-TOKEN")
loRest.AddHeader("Content-Type","application/json")
loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestSb("POST","/2/files/list_folder",loSbRequestBody,loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
lnRespStatusCode = loRest.ResponseStatusCode
IF (lnRespStatusCode >= 400) THEN
? "Response Status Code = " + STR(lnRespStatusCode)
? "Response Header:"
? loRest.ResponseHeader
? "Response Body:"
? loSbResponseBody.GetAsString()
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.LoadSb(loSbResponseBody)
* See the Online Tool for Generating JSON Parse Code
lcCursor = loJsonResponse.StringOf("cursor")
lnHas_more = loJsonResponse.BoolOf("has_more")
i = 0
lnCount_i = loJsonResponse.SizeOfArray("entries")
DO WHILE i < lnCount_i
loJsonResponse.I = i
lcTag = loJsonResponse.StringOf('entries[i].".tag"')
lcName = loJsonResponse.StringOf("entries[i].name")
lcPath_lower = loJsonResponse.StringOf("entries[i].path_lower")
lcPath_display = loJsonResponse.StringOf("entries[i].path_display")
lcId = loJsonResponse.StringOf("entries[i].id")
lcClient_modified = loJsonResponse.StringOf("entries[i].client_modified")
lcServer_modified = loJsonResponse.StringOf("entries[i].server_modified")
lcRev = loJsonResponse.StringOf("entries[i].rev")
lnSize = loJsonResponse.IntOf("entries[i].size")
lcContent_hash = loJsonResponse.StringOf("entries[i].content_hash")
i = i + 1
ENDDO
RELEASE loRest
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJsonResponse
{
"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
}