Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Gary_Boxer's avatar
Gary_Boxer
Helpful | Level 5
6 years ago
Solved

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.

3 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    6 years ago

    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_Boxer's avatar
    Gary_Boxer
    Helpful | Level 5
    6 years ago

    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.

  • Lukag's avatar
    Lukag
    Collaborator | Level 8
    2 years ago

    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

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If 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, Facebook or Instagram.

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!