Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi,
I have tried to get account through this API https://api.dropboxapi.com/2/users/get_account using SOAPUI and passing account_id in request body.
{
"account_id":"dbid:AACCsTU3d_-j5rfgJkGLObJErDLctQmUZw0"
}
If account_id is incorrect but having 40 character then error is coming in to JSON formate
{
"error_summary": "no_account/.",
"error": {".tag": "no_account"}
}
If I am passing the account_id less then 40 character or more then 40 character then response is not coming into JSON. It is coming into text/plain.
<data contentType="text/plain; charset=utf-8" contentLength="144"><![CDATA[Error in call to API function "users/get_account": request body: account_id: 'dbid:bbCCsLObJErDLctQmUZw0' must be at least 40 characters, got 26]]></data>
Thanks,
Shashi Bala
The difference in response format, of JSON versus text, is expected in these different cases.
If the ID has the right format, the API will look it up, and return an error if it isn't found.
If the ID doesn't have the right format, e.g., it's the wrong length, it will fail validation, and the API won't bother trying to look it up.
You can check the response status code to see the different kinds of failures, and check the response Content-Type header to see what format the response body is in.
For example, using curl, these two calls look like: (responses trimmed for brevity)
curl -vX POST https://api.dropboxapi.com/2/users/get_account \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"account_id\": \"dbid:AACCsTU3d_-j5rfgJkGLObJErDLctQmUZw0\"}" # < HTTP/1.1 409 Conflict # ... # < Content-Type: application/json # ... # {"error_summary": "no_account/.", "error": {".tag": "no_account"}} curl -vX POST https://api.dropboxapi.com/2/users/get_account \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"account_id\": \"dbid:notvalidformat\"}" # < HTTP/1.1 400 Bad Request # ... # < Content-Type: text/plain; charset=utf-8 # ... # Error in call to API function "users/get_account": request body: account_id: 'dbid:notvalidformat' must be at least 40 characters, got 19
The API itself doesn't return the data/CDATA formatting in your post, so that is presumably coming from whatever tools you're using.
Hi there!
If you need more help you can view your support options (expected response time for a 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!