Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Leon_NAM
5 years agoHelpful | Level 5
API Call using Integromat returns error
Hey there,
I want to create an automated API Call to our company's Dropbox that creates a folder with only select user groups having access. To do that I am using the Dropbox "Make an API Call"...
Leon_NAM
4 years agoHelpful | Level 5
Hey Здравко ,
thanks for the hint. I was using the /share_folder call on a folder that was created by another team member and in it the call was supposed to create a folder called 'test'. I wanted to take this out of the equation for now as it might be fixed if I give the Integromat app more permissions in the dropbox but I can't access those preferences right now.
So what I did to test the actual API call is I went into the root folder (a folder I most definetely own) and executed the program. I do get a new error here (which I would say is a success!) and it reads: "[400] Error in call to API function "sharing/share_folder": request body: could not decode input as JSON". Did I do something wrong in the body of the call?
Here's my input:
URL
/2/sharing/share_folder
Body
{ "path": "/not a machine cloud/test", "acl_update_policy": "editors", "force_async": false, "member_policy": "team", "shared_link_policy": "members", "access_inheritance": "no_inherit"}
Dropbox API Endpoint
api
Method
POST
--
Headers:
Key
Content-Type
Value
application/json
--
Disable Dropbox API Path Root
Disable Dropbox API Path Root
false
Thanks for all your help!
Greg-DB
Dropbox Community Moderator
4 years agoA "request body: could not decode input as JSON" should indicate that the request body the app is sending is not valid JSON, and so could not be parsed by the Dropbox API server as the parameters for the call. The body you showed here appears to be valid JSON though, and I can't reproduce the issue using it; can you double check that that's the exact value your client is sending? It may help to enable verbose output showing the actual raw HTTP request you're sending, if possible.
- Leon_NAM4 years agoHelpful | Level 5
Hey Greg-DB thanks for your response! I have decided to ditch the premade module and go for the regular "HTTP - Make an OAuth 2.0 request" module to try to make this call. This one actually gives me the same error but a lot more information on the input and output so here it goes (in place of <OAuth Code> I have put my token from the app console) :
Input:
[ { "ca": null, "qs": [], "url": "https://api.dropboxapi.com/2/sharing/share_folder", "data": "{ \"path\": \"/not a machine cloud/test\", \"acl_update_policy\": \"editors\", \"force_async\": false, \"member_policy\": \"team\", \"shared_link_policy\": \"members\", \"access_inheritance\": \"no_inherit\"}", "gzip": true, "method": "post", "headers": [ { "name": "Authorization", "value": "Bearer <OAuth Code>" } ], "timeout": null, "useMtls": false, "bodyType": "raw", "contentType": "application/json", "serializeUrl": false, "shareCookies": false, "parseResponse": false, "followRedirect": true, "useQuerystring": false, "followAllRedirects": false, "rejectUnauthorized": true }Output:
[ { "statusCode": 400, "headers": [ { "name": "cache-control", "value": "no-cache" }, { "name": "content-security-policy", "value": "sandbox allow-forms allow-scripts" }, { "name": "x-content-type-options", "value": "nosniff" }, { "name": "content-type", "value": "text/plain; charset=utf-8" }, { "name": "accept-encoding", "value": "identity,gzip" }, { "name": "date", "value": "Thu, 16 Dec 2021 12:48:46 GMT" }, { "name": "server", "value": "envoy" }, { "name": "content-length", "value": "98" }, { "name": "x-dropbox-response-origin", "value": "far_remote" }, { "name": "x-dropbox-request-id", "value": "66fdbaa00e7f4eccbc5f1d3d78199118" }, { "name": "connection", "value": "close" } ], "cookieHeaders": [], "data": "Error in call to API function \"sharing/share_folder\": request body: could not decode input as JSON", "fileSize": 98 } ] - Здравко4 years agoLegendary | Level 20
Leon_NAM wrote:...
Input:
... "gzip": true, ......
Hi Leon_NAM,
You are using gzip encoding in your request. Dropbox API uses flat requests parameters (including passed as body) and any type of encoding can confuse it. Do you able forbid the encodings for all Dropbox API requests? 🧐
Let's see if this can help.
- Leon_NAM4 years agoHelpful | Level 5
Hey Здравко,
I tried that but it returns the same error.
Input:
[ { "ca": null, "qs": [], "url": "https://api.dropboxapi.com/2/sharing/share_folder", "data": "{ \"path\": \"/not a machine cloud/test\", \"acl_update_policy\": \"editors\", \"force_async\": false, \"member_policy\": \"team\", \"shared_link_policy\": \"members\", \"access_inheritance\": \"no_inherit\"}", "gzip": false, "method": "post", "headers": [ { "name": "Authorization", "value": "Bearer <OAuth 2.0 Token>" } ], "timeout": null, "useMtls": false, "bodyType": "raw", "contentType": "application/json", "serializeUrl": false, "shareCookies": false, "parseResponse": false, "followRedirect": true, "useQuerystring": false, "followAllRedirects": false, "rejectUnauthorized": true } ]Output:
[ { "statusCode": 400, "headers": [ { "name": "cache-control", "value": "no-cache" }, { "name": "content-security-policy", "value": "sandbox allow-forms allow-scripts" }, { "name": "x-content-type-options", "value": "nosniff" }, { "name": "content-type", "value": "text/plain; charset=utf-8" }, { "name": "accept-encoding", "value": "identity,gzip" }, { "name": "date", "value": "Thu, 16 Dec 2021 14:25:52 GMT" }, { "name": "server", "value": "envoy" }, { "name": "content-length", "value": "98" }, { "name": "x-dropbox-response-origin", "value": "far_remote" }, { "name": "x-dropbox-request-id", "value": "315f864799fa46c7a4c30fab485af071" }, { "name": "connection", "value": "close" } ], "cookieHeaders": [], "data": "Error in call to API function \"sharing/share_folder\": request body: could not decode input as JSON", "fileSize": 98 } ] - Greg-DB4 years ago
Dropbox Community Moderator
Unfortunately I don't have more specific error information add here beyond the message that the parsing failed. The data shown here does appear to be valid JSON, but it's unclear if/how this may be being transformed when being set in the actual HTTPS request being sent. When I try this value myself with this endpoint just using curl I do not get this error, so it does some it's getting malformed by the client somehow. The best way to debug this would be to print out the actual request being sent.
I presume the \ characters are just to escape the quotes and are not being sent to the API, but that may be good to verify. Likewise, the extra whitespace shouldn't matter, but it may be useful to remove it to eliminate that as a potential issue.
- Leon_NAM4 years agoHelpful | Level 5
you're right it's all a bit pointless when we don't know what the flat HTTPS request is exactly. I suspect there's something weird happening on Integromat's side of things as well. I have reached out to their support and am awaiting response. I will post here once they tell me what they think the issue is. Until then: Thanks and have a good one!
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!