We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

gilbertwulff's avatar
gilbertwulff
Explorer | Level 3
8 years ago

Uploading to a shared folder through api

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    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.

  • gilbertwulff's avatar
    gilbertwulff
    Explorer | Level 3
    8 years ago

    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. 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    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.
  • gilbertwulff's avatar
    gilbertwulff
    Explorer | Level 3
    8 years ago

    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)

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    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.
  • Wuyi's avatar
    Wuyi
    New member | Level 2
    7 years ago

    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? 

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 9 hours ago
411 Following

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!