One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
amitsinha
8 years agoExplorer | Level 4
Error in call to API function "sharing/list_folders"
Hi,
below is my code to get a list of folders, but when I run this code it throws an error. Please see this error.
Error in call to API function "sharing/list_folders": request body: could not decode input as JSON
Please help.
// My Code $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://api.dropboxapi.com/2/sharing/list_folders"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Authorization: Bearer YOUR_TOKEN' )); curl_setopt($ch, CURLOPT_POSTFIELDS, "limit=100&actions=[]");
[Cross-linking for reference: https://stackoverflow.com/questions/45937861/error-in-call-to-api-function-sharing-list-folders ]
This error message indicates that the request body, which is supposed to contain the API call parameters as JSON, could not be successfully read by the Dropbox API as JSON.
That error looks correct in this case, as you're supplying form URL encoded parameters instead of JSON. The JSON would instead look like:
"{"limit": 100,"actions": []}"
- Greg-DB
Dropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/45937861/error-in-call-to-api-function-sharing-list-folders ]
This error message indicates that the request body, which is supposed to contain the API call parameters as JSON, could not be successfully read by the Dropbox API as JSON.
That error looks correct in this case, as you're supplying form URL encoded parameters instead of JSON. The JSON would instead look like:
"{"limit": 100,"actions": []}"
- amitsinhaExplorer | Level 4
Thanks a lot. It's working now.
- vijaysingh109Explorer | Level 4
Hi,
The solution link is not working, can you please help to understand what was the fix?
I am facing the same issue?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,953 PostsLatest Activity: 7 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!