We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
martinjuniqe
8 years agoExplorer | Level 4
Need help managing photos with DropBox
Hello Dropbox!
I am trying to set up an automated workflow via zapier for our company juniqe.com:
i need to invite new folder members as editors via their email, am am trying to do so via a webhook POST to the endpoint:
https://api.dropboxapi.com/2/sharing/add_folder_member
with the following data:
"{\"shared_folder_id\": \"{{folderid123456}}\",\"members\": [{\"member\": {\".tag\": \"email\",\"email\": \"{{memberemail123456}}\"},\"access_level\": \"editor\"}],\"quiet\": false,\"custom_message\": \"Here's your share folder!\"}"
this always returns: api.dropboxapi.com returned (400) Bad Request and said nothing
I can authenticate correctly and it recognizes the end point, i am sure the error is in the syntax somewhere :)
I'd really appreciate it if you could assist me and point me in the right direction - i am not a coder and am just taking a crack at something our product team hasn't had time for...
Have a good day, cheers from berlin!
Martin
If you know the path or ID for the folder, and the folder is already a shared folder, you can get the shared folder ID by calling /2/files/get_metadata. The shared folder ID will be in the result at folder.sharing_info.shared_folder_id. Using /2/sharing/list_folders[/continue] on the folder's parent also works.
Note that creating a shared link for a folder does not make it a "shared folder". These actually refer to two different types of sharing on Dropbox: "shared links" and "shared folders". Folders will only receive shared folder IDs for the second type of sharing, "shared folders".
It sounds like you may have used /2/sharing/create_shared_link_with_settings to make a shared link for the folder. To share the folder in order to get a shared folder ID, you should use /2/sharing/share_folder.
16 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
Can you print the response body? It should contain a more useful error message. (The output here is just the status line.) - chirstius8 years ago
Dropbox Staff
Hello martinjuniqe,
Can you confirm if you are setting this up via the Zapier web interface or doing it programmatically?
I was able to test via the web UI and this endpoint can definitely be called from a webhook. If you are configuring it from the web UI I can walk you through how I setup a test request to hit the endpoint. If it's a programmatic call it would be useful to see the code you are using around this call to help identify any issues.
Thanks,
-Chuck
- martinjuniqe8 years agoExplorer | Level 4
Hey Chuck @chirstius
Yes, it's being done via the web interface, not programmatically.Could you maybe sshare the code that you used to test? Like i said, i am not a coder (my job here actually is art curator, don't ask my why i am doing what i am doing lol), so any copy&pastable examples would be great, i am sure i am just messing up the syntax.
Thanks a ton! - chirstius8 years ago
Dropbox Staff
Sorry for the delayed response, here are the steps I took:
First, configure whatever trigger you plan to use for the zap.
Next, when you configure an action, select "webhook" and choose "Custom Request" and configure it as follows:
NOTE - This assumes you are using a Team-linked access token with the member file access permission. If you are using a user-linked access token you can remove the 'Dropbox-API-Select-User' header. If you don't know how to get the <owner_memebr_id> placeholder value you can use the endpoint:
https://www.dropbox.com/developers/documentation/http/teams#team-members-get_info
Which can quickly be accessed from the API Explorer here:
https://dropbox.github.io/dropbox-api-v2-explorer/team/#team_members/get_info
Use the email of an account that has permission to add members to the folder and from the results get their team_member_id which will look like 'dbmid:abcdef12345' and use that for the 'Dropbox-API-Select-User' header value.
Fill in all other placeholder values as appropriate from previous Zapier steps/data and hopefully this will get you moving in the right direction.
-Chuck
- martinjuniqe8 years agoExplorer | Level 4
Hey Chuck!
I am trying to follow your example but am receiving the following error codeWe had trouble sending your test through. Please try again. Error:
api.dropboxapi.com returned (400) Bad Request and said "Error in call to API function "sharing/add_folder_member": Unexpected select user header. Your app does not have permission to use this featurei am pasting my request below, is this something to do with the user i am authenticating as?
- Greg-DB8 years ago
Dropbox Community Moderator
It sounds like you're not using a "team-linked" app (i.e., an app registered for the "Dropbox Business API"). The Dropbox-API-Select-User header is only meant for team-linked apps. Since you're using a "user-linked" app (i.e., an app registered for the "Dropbox API"), you should remove the Dropbox-API-Select-User header. - martinjuniqe8 years agoExplorer | Level 4
Hi Greg, I tried your suggestion and removed the header, now resulting in the following error again:
api.dropboxapi.com returned (400) Bad Request and said nothing
Is there a way to find out if we're using a team or user linked account?
It seems like I am hitting a wall with this, and it (seems) to be so dirt simple!
Your help is really appreciated. I just think i might need a little more of it!
- martinjuniqe8 years agoExplorer | Level 4Hi Greg, I tried your suggestion and removed the header, now resulting in the following error again:
api.dropboxapi.com returned (400) Bad Request and said nothing
Is there a way to find out if we're using a team or user linked account?
It seems like I am hitting a wall with this, and it (seems) to be so dirt simple!
Your help is really appreciated. I just think i might need a little more of it!
- Greg-DB8 years ago
Dropbox Community Moderator
martinjuniqe Is that the actual/full output you get? There should be more useful information in the response body for that 400 error (not "nothing").
You can check your app type(s) on the App Console. Any apps with the "Full Dropbox" or "App folder" permissions are "user-linked". Any apps with a "Team" permission are "team-linked".
- martinjuniqe7 years agoExplorer | Level 4
just wanted to follow up on this again, since i've still not gotten it to work. You were right, my app is 'user-linked' so the header Select-User has since been removed...
I understand that you chirstius set this up via the zapier web interface, but i am really not seeing where i went off script compared to you
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,035 PostsLatest Activity: 6 hours ago
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 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!