cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We love to hear how every person gets the most from Dropbox, and it seems everyone has a slightly different use for it - tell us yours here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error in call to API function "files/list_folder": request body: unknown field 'Path'

Error in call to API function "files/list_folder": request body: unknown field 'Path'

Gary_Boxer
Helpful | Level 5

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=

1 Accepted Solution

Accepted Solutions

Re: Error in call to API function "files/list_folder": request body: unknown field 'Path'

Gary_Boxer
Helpful | 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.

View solution in original post

2 Replies 2

Re: Error in call to API function "files/list_folder": request body: unknown field 'Path'

Greg-DB
Dropboxer

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".

Re: Error in call to API function "files/list_folder": request body: unknown field 'Path'

Gary_Boxer
Helpful | 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.

View solution in original post

Who's talking

Top contributors to this post

  • User avatar
    Gary_Boxer Helpful | Level 5
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?