You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Gary_Boxer
5 years agoHelpful | Level 5
Error in call to API function "files/list_folder": request body: unknown field 'Path'
I have a sample WinDev code below which login to Dropbox and obtain a Token and try to list the files/folder in the root. ie Path = "".
when it gets to the line "HTTPresponse is httpResponse = HTTPSend(req)", the request comes back with Error in call to API function "files/list_folder": request body: unknown field 'Path', even if you enter a path like apps/<appname>/<foldername> it error out.
If someone can point out what the issue is. That will be most appreciated.
// Example used to retrieve a token to perform a request on DropBox
OAuth2Params is OAuth2Parameters
OAuth2Params..ClientID = "<ClientId from App>"
OAuth2Params..ClientSecret = "<ClientSecret from App>"
OAuth2Params..AuthURL = "https://www.dropbox.com/oauth2/authorize"
OAuth2Params..TokenURL = "https://api.dropboxapi.com/oauth2/token"
OAuth2Params..RedirectionURL = "http://localhost:56207/"
OAuth2Params..AdditionalParameters = "force_reapprove=false"
// Ask for authentication: opens the login window
MyToken is AuthToken = AuthIdentify(OAuth2Params)
// Request authenticated on a DropBox API
req is httpRequest
req..Method = httpPost
req..URL = "https://api.dropboxapi.com/2/files/list_folder"
req..AuthToken = MyToken // Authentication token
req..ContentType = "application/json"
vAPIParam is Variant
vAPIParam.Path = "" //Tried entering a path or leave blank but encounter an error
vAPIParam.recursive = False
vAPIParam.include_media_info = False
vAPIParam.include_deleted = False
vAPIParam.include_has_explicit_shared_members = False
req..Content = VariantToJSON(vAPIParam)
HTTPresponse is httpResponse = HTTPSend(req)
let Data = JSONToVariant(HTTPresponse..Content)
Request
<httpRequest> URL="https://api.dropboxapi.com/2/files/list_folder" UserAgent="SecureFile" Content={ "Path":"", "recursive":false, "include_media_info":false, "include_deleted":false, "include_has_explicit_shared_members":false } ContentType="application/json" User="" Password="" Method=2 IgnoreError=0 Timeout=20 000 DownloadProgress=<httpProgress> UploadProgress=<httpProgress> ConnectionTimeout=0 AuthToken=<AuthToken> VersionSSL=0 Destination="" ProcedureTrace= ClientCertificate= ClientCertificatePassword="" MaxUploadRate=-1 MaxDownloadRate=-1 Header=
Response
<httpResponse> Content=Error in call to API function "files/list_folder": request body: unknown field 'Path' RoughHeader="HTTP/1.1 400 Bad Request<CR>Server: nginx<CR>Date: Thu, 21 May 2020 02:31:17 GMT<CR>Content-Type: text/plain; charset=utf-8<CR>Transfer-Encoding: chunked<CR>Connection: close<CR>Content-Security-Policy: sandbox; frame-ancestors 'none'<CR>X-Dropbox-Request-Id: b3119f3ab3741ecf437d1bccbdffed88<CR>X-Envoy-Upstream-Service-Time: 82<CR>X-Frame-Options: DENY<CR>X-Content-Type-Options: nosniff<CR>Content-Disposition: attachment; filename='error'<CR><CR>" StatusCode=400 DescriptionStatusCode="Bad Request" ContentType="text/plain; charset=utf-8" Header=
Thanks, Greg, I have changed the path from "Path" to "path" and it is returning the list of files from the folder. Really appreciate your quick response and spotting the error. Will remember that parameters are case-sensitive.
- Greg-DBDropbox Staff
Dropbox API v2 parameter names are case-sensitive. The parameter you're trying to use on /2/files/list_folder is named "path", so you'll need to specify "path" instead of "Path".
- Gary_BoxerHelpful | Level 5
Thanks, Greg, I have changed the path from "Path" to "path" and it is returning the list of files from the folder. Really appreciate your quick response and spotting the error. Will remember that parameters are case-sensitive.
- LukagCollaborator | Level 8
Hi Gary_Boxer,
i found this post very interesting because i'd need access to file of dropbox.
I use vb.net in my web application.
Do you know where can i found some example to dim authparameter, use token etc etc ?
Thank you
Luca
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,885 PostsLatest Activity: 5 years agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!