cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

Dropbox's code example for sharing a file link in Python not working

Dropbox's code example for sharing a file link in Python not working

cristrod817
Explorer | Level 3
Go to solution
#Python code provided by Dropbox
import requests
import json

headers = {
    "Authorization": "Bearer append-current-token"
"Content-Type": "application/json"
}
data = {
    "path": "/baby dream/Cris Rodriguez/10yrsZ.tif"
}

r = requests.post(url, headers=headers, data=json.dumps(data))
print(r.text)
 
I am getting this error text: 400
 
Error in call to API function "sharing/get_shared_link_metadata":
This function requires its argument in the HTTP request body, but your request body is empty.
 
This is the default code provided by Dropbox which I am trying to implement but to no avail.
I've done my research to no avail.  Need help desperately.
 
I am using VS Code as my editor, Windows 10 latest version, Python 3.10.10



10 Replies 10

Greg-DB
Dropbox Staff
Go to solution

@cristrod817 Здравко is correct; /2/sharing/get_shared_link_metadata is for getting information about an existing shared link that you would specify. It isn't a way to create or retrieve a shared link. I see you were specifying a "url" parameter value of "https://api.dropboxapi.com/2/sharing/get_file_metadata", which is the Dropbox API endpoint, not a Dropbox shared link. You can find information about Dropbox shared links here.

 

To create a shared link using the API, you would instead use /2/sharing/create_shared_link_with_settings. To list existing shared links, you would use /2/sharing/list_shared_links.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    cristrod817 Explorer | Level 3
What do Dropbox user levels mean?