Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
AndreyStrukov
7 years agoHelpful | Level 5
Request body could not decode input as JSON
Hello!
The follow code (qt c++)
QUrl url;
url.setScheme("https");
url.setHost("api.dropboxapi.com");
url.setPath("/2/file_requests/list_v2");
QUrlQuery params;
params.addQueryItem("limit", "1000");
QByteArray qb_params;
qb_params.append(params.toString(QUrl::FullyEncoded));
if(checkUrl(url)){
QNetworkRequest request; //
request.setUrl(url);
QByteArray auth;
auth.append(OAuth_);
auth.prepend("Bearer ");
request.setRawHeader("Authorization", auth);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
manager->post(request, qb_params); //
}got an error:
"Error transferring https://api.dropboxapi.com/2/file_requests/list_v2 - server replied: Bad Request" "Error in call to API function \"file_requests/list:2\": request body: could not decode input as JSON"
What's wrong?
Hi AndreyStrukov,
Can you clarify, what you really ask? :thinking: In the error message is clearly stated: "could not decode input as JSON"!
If you take a look on list_v2 documentation, can be seen that parameters have to be in JSON format. Where you encode your parameter ("limit") in JSON? Instead, you use 'QUrlQuery' class, which functionality mimics classic HTML form encoding (not JSON)! :wink:
Hope this gives some direction.
2 Replies
- Здравко7 years agoLegendary | Level 20
Hi AndreyStrukov,
Can you clarify, what you really ask? :thinking: In the error message is clearly stated: "could not decode input as JSON"!
If you take a look on list_v2 documentation, can be seen that parameters have to be in JSON format. Where you encode your parameter ("limit") in JSON? Instead, you use 'QUrlQuery' class, which functionality mimics classic HTML form encoding (not JSON)! :wink:
Hope this gives some direction.
- AndreyStrukov7 years agoHelpful | Level 5
Thank you, got it!
I've fixed it and now it works.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!