cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Error in call to API function "sharing/list_folders"

Error in call to API function "sharing/list_folders"

amitsinha
Explorer | Level 4

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=[]");

 

1 Accepted Solution

Accepted Solutions

Re: Error in call to API function "sharing/list_folders"

Greg-DB
Dropboxer

[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": []}"

 

 

View solution in original post

4 Replies 4

Re: Error in call to API function "sharing/list_folders"

Greg-DB
Dropboxer

[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": []}"

 

 

Re: Error in call to API function "sharing/list_folders"

amitsinha
Explorer | Level 4

Thanks a lot. It's working now.

Re: Error in call to API function "sharing/list_folders"

vijaysingh109
Explorer | Level 3

Hi,

The solution link is not working, can you please help to understand what was the fix?

I am facing the same issue?

Re: Error in call to API function "sharing/list_folders"

Greg-DB
Dropboxer

@vijaysingh109 The original StackOverflow question has been deleted, but the question and my answer here still apply.

If something isn't working for you, please feel free to open a new thread with the relevant code and the error/output you're getting so we can take a look.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    vijaysingh109 Explorer | Level 3
  • User avatar
    amitsinha Explorer | Level 4
What do Dropbox user levels mean?
Need more support?