Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

5 Replies

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

    Yes, you can use /2/files/list_folder[/continue] (files_list_folder/files_list_folder_continue and filesListFolder/filesListFolderContinue in the Python SDK and JavaScript SDKs, respectively) to list the contents under any particular path. You can use /2/sharing/create_shared_link_with_settings (sharing_create_shared_link_with_settings and sharingCreateSharedLinkWithSettings in the Python SDK and JavaScript SDKs, respectively) to create a shared link for any particular file or folder.

     

    I recommend reading the File Access Guide and Sharing Guide.

  • alicera's avatar
    alicera
    Explorer | Level 3
    4 years ago
    ```
    dbx.sharing_create_shared_link_with_settings('/data/')
    dbx.sharing_create_shared_link_with_settings('/data/'1.jpg)
    At the dropbox have it.
    ```
    It doesnt work.
     
    ```
    Traceback (most recent call last):
    File "share.py", line 57, in <module>
    shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Model/s.pt", settings=None)
    File "/opt/conda/lib/python3.8/site-packages/dropbox/base.py", line 4131, in sharing_create_shared_link_with_settings
    r = self.request(
    File "/opt/conda/lib/python3.8/site-packages/dropbox/dropbox_client.py", line 348, in request
    raise ApiError(res.request_id,
    dropbox.exceptions.ApiError: ApiError(
    ```
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    Can you share the full error message? You seem to have truncated the output here.

  • alicera's avatar
    alicera
    Explorer | Level 3
    4 years ago

    Here is my code

    ```

    dbx = dropbox.Dropbox()
    shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Model/s.pt")
    ```

     

    Message

    Here is I use the No expiration token

    Is it safe for me to show metadata here ?

     

    /Pictures/Dropbox/dropbox-sdk-python/example# python share.py

    Traceback (most recent call last):
    File "share.py", line 55, in <module>
    shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Model/s.pt")
    File "/opt/conda/lib/python3.8/site-packages/dropbox/base.py", line 4131, in sharing_create_shared_link_with_settings
    r = self.request(
    File "/opt/conda/lib/python3.8/site-packages/dropbox/dropbox_client.py", line 348, in request
    raise ApiError(res.request_id,
    dropbox.exceptions.ApiError: ApiError('731fb539203145e39e640cb66d80d3e3', CreateSharedLinkWithSettingsError('shared_link_already_exists', SharedLinkAlreadyExistsMetadata('metadata', FileLinkMetadata(client_modified=datetime.datetime(2021, 12, 16, 5, 1, 30), content_owner_team_info=NOT_SET, expires=NOT_SET, id='id:QTPba1EnHBoAAAAAAAAADA', link_permissions=LinkPermissions(allow_comments=True, allow_download=True, audience_options=[LinkAudienceOption(allowed=True, audience=LinkAudience('public', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=False, audience=LinkAudience('team', None), disallowed_reason=LinkAudienceDisallowedReason('user_not_on_team', None)), LinkAudienceOption(allowed=True, audience=LinkAudience('no_one', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=False, audience=LinkAudience('password', None), disallowed_reason=LinkAudienceDisallowedReason('user_account_type', None))], can_allow_download=True, can_disallow_download=False, can_remove_expiry=True, can_remove_password=False, can_revoke=True, can_set_expiry=False, can_set_password=False, can_use_extended_sharing_controls=NOT_SET, effective_audience=NOT_SET, link_access_level=NOT_SET, requested_visibility=RequestedVisibility('public', None), require_password=NOT_SET, resolved_visibility=ResolvedVisibility('public', None), revoke_failure_reason=NOT_SET, team_restricts_comments=False, visibility_policies=[VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('public', None), resolved_policy=AlphaResolvedVisibility('public', None)), VisibilityPolicy(allowed=False, disallowed_reason=VisibilityPolicyDisallowedReason('user_not_on_team', None), policy=RequestedVisibility('team_only', None), resolved_policy=AlphaResolvedVisibility('team_only', None)), VisibilityPolicy(allowed=False, disallowed_reason=VisibilityPolicyDisallowedReason('user_account_type', None), policy=RequestedVisibility('password', None), resolved_policy=AlphaResolvedVisibility('password', None))]), name='s.pt', path_lower='/model/s.pt', rev='015d33c53215f7d000000024ae230a0', server_modified=datetime.datetime(2021, 12, 16, 5, 2, 9), size=6, team_member_info=NOT_SET, url='<REDACTED>))))


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

    This particular error includes the shared link metadata, so you would want to redact the shared link if you don't wish to post that. I've redacted it for you just in case.

     

    Anyway, this error says 'shared_link_already_exists' meaning that a new shared link was not created because one already exists. You can find error types in the documentation, such as here for this CreateSharedLinkWithSettingsError. In some cases like this the existing metadata will be returned in the error which you can get from SharedLinkAlreadyExistsMetadata. You can also call sharing_list_shared_links to list existing shared links. Refer to the documentation for that for the available options when doing so.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with 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!