Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi,
I need to use this endpoint to get the parent_shared_folder_id.
The problem is that my json data does not return this info.
I get a response that looks like this:
{'.tag': 'file', 'name': 'testy2.png', 'path_lower': '/test/testy2.png', 'path_display': '/test/testy2.png', 'id': 'id:AYyyfCw5MFkAAAAAAABqCQ', 'client_modified': '2024-03-08T18:02:38Z', 'server_modified': '2024-03-08T18:02:39Z', 'rev': '61329ff5f6a802ad8828f', 'size': 1054078, 'is_downloadable': True, 'has_explicit_shared_members': False, 'content_hash': '7ae9e640d9ba9f51f129f57b67fdf1e5a22bd94c69f825ec5442e81080a6dca9'}
I'm running this request in python.
import requests
# Define the endpoint URL
url = "https://api.dropboxapi.com/2/files/get_metadata"
# Replace '<get access token>' with your actual access token
access_token = 'ACCESS_TOKEN'
# Define the headers
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
# Define the data payload
data = {
"include_deleted": True,
"include_has_explicit_shared_members": True,
"include_media_info": True,
"path": "/test/testy2.png"
}
# Make the POST request
response = requests.post(url, headers=headers, json=data)
# Print the response
print(response.json())
The sharing_info field, e.g., from /2/files/get_metadata, is optional and only returned, "if this file is contained in a shared folder".
To turn a folder into a shared folder, so that you can then retrieve the shared folder ID like that and/or add members to it, you would use the /2/sharing/share_folder endpoint (or share the folder manually via the Dropbox web site).
Hi,
So I'm seeing the problem. You only get a shared_folder_id returned to you if at least one person has been shared the folder.
I want to get the shared_folder_id so I can add members to a folder (per API specifications, I need to pass this id). The problem is that if I have no preexisting members for a folder, then I can't get the shared_folder_id. So I'm in a chicken-or-the-egg situation.
How do I work around this??
The sharing_info field, e.g., from /2/files/get_metadata, is optional and only returned, "if this file is contained in a shared folder".
To turn a folder into a shared folder, so that you can then retrieve the shared folder ID like that and/or add members to it, you would use the /2/sharing/share_folder endpoint (or share the folder manually via the Dropbox web site).
Thanks! I wasn't aware of the share_folder endpoint.
Hi there!
If you need more help you can view your support options (expected response time for a 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!