Learn how to make the most out of the Dropbox Community here 💙!
Forum Discussion
Abhay Yadav
5 years agoExplorer | Level 4
Bad JSON: expected object value. exception while uplaoding a file using dropbox Java SDK
Hi all, I am trying to upload a file using dropbox Java SDK (version 3.1.5). I amgetting file from a ajax form and then trying to upload it but getting the below exception when calling uploadAndF...
Greg-DB
Dropbox Staff
5 years ago[Cross-linking for reference: https://stackoverflow.com/questions/63973139/bad-json-expected-object-value-dropbox-api-file-upload-error ]
Thanks for the report! This error doesn't reproduce for me with this code though, so we'll need to investigate more. Does this error occur for you when uploading to any file path, or just some path(s) in particular?
Abhay Yadav
5 years agoExplorer | Level 4
I debugged the flow and found the issue. When calling the uploadAndFinish(), somehwere down the line, the API was returning 401 status code, the stack trace was not much helpful though to get the root cause.
I regenerated the access token and it worked!!!
- Greg-DB5 years ago
Dropbox Staff
Thanks for following up. That actually sounds like a bug in the SDK then. The SDK should automatically convert the 'invalid_access_token' error response to a proper exception. I'll look into it and ask the team to fix that up.
- FilipRachunek5 years agoExplorer | Level 4
Hello,
I have the same problem, using Dropbox Java SDK 3.1.5. I suspect the issue could be related to new short-lived access tokens and scoped apps, as I don't see this error with "no expiration" token and "full Dropbox" permission type (created in the past).
So, my first idea was that some scoped permissions were missing, as all read operations work fine, and the problem occurs only with "uploadAndFinish(inputStream)" method. However, I checked the permissions and I didn't see anything wrong there - there are checked checkboxes at files.metadata.write, files.metadata.read, files.content.write, files.content.read.
Can you help, please? I am out of ideas.
Filip
- Greg-DB5 years ago
Dropbox Staff
FilipRachunek This is a bug in the Java SDK. This is still open with engineering, but I don't have an update on it yet. I'll follow up here once I do.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,974 PostsLatest Activity: 8 hours ago
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 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!