cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

Uploading to a shared folder through api

Uploading to a shared folder through api

gilbertwulff
Explorer | Level 3

I'm working on integrating dropbox to my company's website and we want to add a feature in to allow the users to share their shared folders to us and using the dropbox api, we upload files to the shared folder that they provided. These shared folders will be in a seperate account that the one we use on our website. 

 

Is this possible using the dropbox api v2?

8 Replies 8

Re: Uploading to a shared folder through api

Greg-DB
Dropboxer

Yes, the Dropbox API does offer the ability to both share folders and upload into shared folders.

 

To share a folder with another account, you can use /2/sharing/share_folder to share the folder, and /2/sharing/add_folder_member to invite another account.

 

On the recipient account, you can list folders that you can add to the account using /2/sharing/list_mountable_folders[/continue] and then add them to your account using /2/sharing/mount_folder

 

You can then upload to the folder using /2/files/upload.

 

We recommend using an official SDK, if one is available for your platform. They will have corresponding methods for the above endpoints.

 

Note that when you register the API app for this, you'll need to use the "full Dropbox" permission, not "app folder". Apps with the app folder permission can't access shared folders.

Re: Uploading to a shared folder through api

gilbertwulff
Explorer | Level 3

Thanks for your reply! 

I saw that API endpoint too, now that confirms that i was looking at the right thing.

Next question is, how exactly would i put the path in. The path being the recipient's shared folder link.

"path": "/Homework/math/Matrices.txt",

It worked when i was saving to my account's folder path but i tried putting in the recipient's shared folder link but it didnt work.

How exactly should the format be. 

Re: Uploading to a shared folder through api

Greg-DB
Dropboxer
A shared folder can different paths in different accounts (since users can move shared folders, etc.) That being the case, when operating on a shared folder via path, make sure you're using the path from the account you're operating on. The SharedFolderMetadata, e.g., returned by /2/sharing/list_folders[/continue] returns the path for the linked account, so make sure you're calling on the right account.

Anyway, I mentioned several endpoints, so I'm not sure exactly what step you're getting stuck on. If you're running in to an issue, please share the code and output showing it.

Re: Uploading to a shared folder through api

gilbertwulff
Explorer | Level 3

Yeap that was one of the way that i tested and it worked. But i'm talking bout when a user just gives us a shared link to their folder instead of adding us to the shared user's list on the folder

 

Is there a way to upload to that folder with just the shared folder link that they gave us? or do we have to be given access to the folder and then we will have to use the path that we get from /2/sharing/list_folders[/continue] on our own account and then upload to that path.

 

Can we directly upload to the folder link that the recipient on another account gives us (image attached is the way they get the folder link)Capture.JPG

Re: Uploading to a shared folder through api

Greg-DB
Dropboxer
I see, thanks for the screenshot! No, you can't upload to a folder just with the link.

That shared link is a different kind of sharing, and only provides read-access. You'd need to actually be invited to the shared folder (or the shared parent folder, in the case of the screenshot) to be able to write to it.

Re: Uploading to a shared folder through api

gilbertwulff
Explorer | Level 3

Gotcha! Thanks Greg for answering my question!

Re: Uploading to a shared folder through api

Wuyi
New member | Level 2

In a request to make folder shareable, i got 

 

REQUEST

curl -X POST https://api.dropboxapi.com/2/sharing/share_folder \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"path":"/pictures/hello","link_settings":{}}'

 

 

RESPONSE

{ "error_summary": "no_permission/", "error": { ".tag": "no_permission" }, "user_message": { "locale": "en", "text": "You don’t have permission to perform this action." } }

 

What exactly am doing wrong? 

 

Re: Uploading to a shared folder through api

Greg-DB
Dropboxer

@Wuyi It looks like you're running in to the issue discussed here:

 

https://www.dropboxforum.com/t5/API-Support-Feedback/https-api-dropboxapi-com-2-sharing-share-folder...

 

Please check out that thread for information on how to avoid this. Thanks and apologies for the bother!

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    Wuyi New member | Level 2
  • User avatar
    gilbertwulff Explorer | Level 3
What do Dropbox user levels mean?
Need more support?