cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

/add_folder_member suddenly gets a 400 response

/add_folder_member suddenly gets a 400 response

Leon_NAM
Helpful | Level 5
Go to solution

Hey there,

 

I have an automation where I...

 

1. Create a shared folder (inherited access)

2. Check if this folder was created successfully

3. Create a shared subfolder to the first folder which is shared with nobody (no_inherit)

4. Check if that folder was created successfully

5. Add the appropriate member groups to the subfolder

 

This used to work fine until a few months back when I noticed that step 5 had a 400 response: "Error in call to API function "sharing/add_folder_member": request body: could not decode input as JSON". Since then I couldn't get it to work anymore. The rest of the steps works as expected.

 

Here is my /add_folder_member api call input (I'm using make.com by the way):

 

 

 

[
    {
        "ca": null,
        "qs": [],
        "url": "https://api.dropboxapi.com/2/sharing/add_folder_member",
        "data": "{\"custom_message\": \"Documentation for launch day\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"g:092309be814897100000000000004ac1\"},\"access_level\": \"editor\"},{\"member\":{\".tag\": \"dropbox_id\",\"dropbox_id\": \"g:092309be814897100000000000003ab1\"},\"access_level\": \"editor\"}],\"quiet\": true,\"shared_folder_id\": \"3021562177\"\"}",
        "gzip": false,
        "method": "post",
        "headers": [
            {
                "name": "Dropbox-API-Select-Admin",
                "value": "xxx"
            }
        ],
        "timeout": null,
        "useMtls": false,
        "bodyType": "raw",
        "contentType": "application/json",
        "serializeUrl": false,
        "shareCookies": false,
        "parseResponse": false,
        "followRedirect": false,
        "useQuerystring": false,
        "rejectUnauthorized": false
    }
]

 

 

 

Can anybody help?

 

Thanks!!

 

Leon 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

The "request body: could not decode input as JSON" error should indicate that the value you're sending in the request body couldn't be successfully parsed as JSON.

 

In this case, that should be the value you have in the "data" field. Looking at that value, it seems the issue is that you have an extra \" at the end in \"\". That should just be a single \", to close the shared_folder_id field value.

 

In general, we recommend using some JSON library to build these strings whenever possible, as that will help avoid issues like that.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

The "request body: could not decode input as JSON" error should indicate that the value you're sending in the request body couldn't be successfully parsed as JSON.

 

In this case, that should be the value you have in the "data" field. Looking at that value, it seems the issue is that you have an extra \" at the end in \"\". That should just be a single \", to close the shared_folder_id field value.

 

In general, we recommend using some JSON library to build these strings whenever possible, as that will help avoid issues like that.

Leon_NAM
Helpful | Level 5
Go to solution

Thank you so much. That was it. I was focusing so much on this api call that I totally missed that the variable providing the shared folder ID was passing along an extra " symbol where it shouldn't.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Leon_NAM Helpful | Level 5
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?