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=