I\'m failing to upload files into dropbox in iOS in CoreApI
I\'m getting this message
[WARNING] DropboxSDK: error making request to /1/files_pu
From the Dropbox docs for file_put:
URL Structure
https://api-content.dropbox.com/1/files_put/
/ ?param=val root The root relative to which path is specified. Valid values are sandbox and dropbox.
path The path to the file you want to retrieve.
A key bit of information in your error message is the path portion of the URI made in the request. Relevant line from your error message:
error making request to /1/files_put/sandboxsandbox/helloworld.txt
Compared to the URL structure from the docs, for
you've used sandboxsandbox
, but the docs say only sandbox
and dropbox
are valid values.
The error in the JSON response body has a similar clue:
error=Expected 'root' to be 'dropbox', 'sandbox', or 'auto', got u'sandboxsandbox'
Referring to the API docs is unnecessary as the error message spells out that sandboxsandbox
isn't among the list of valid values for root.
Though slightly less obvious, this bit in the JSON when compared to the URL structure and the documentation gives a hint:
destinationPath=sandbox/helloworld.txt
After a small leap that destinationPath corresponds to path in the API docs and reading that root is "the root relative to which path is specified" you can surmise that the path shouldn't contain the root. Whether it should be /helloworld.txt
or helloworld.txt
can be deduced by seeing that the URL structure already accounts for a /
between
and
. Compare these expansions using /helloworld.txt
and helloworld.txt
respectively:
/1/files_put//
/1/files_put/sandbox/
/1/files_put/sandbox//helloworld.txt
/1/files_put//
/1/files_put/sandbox/
/1/files_put/sandbox/helloworld.txt
It should be clear which value of path is correct.