cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

How to detect an invalid share URL?

How to detect an invalid share URL?

Sidharth C.
New member | Level 1

Hi, 

I am trying to make a small app which when gets an input of public dropbox URL, returns you the file. But when an invalid URL is entered, the status received is 200. But there is image showing 404. Is there a way or a api through which I could check if the shared link is valid or not?

5 Replies 5

Rich
Super User II

Moved to the API forum.

Greg-DB
Dropbox Staff

Unfortunately, we don't currently have a good way to detect this programmatically, but I'll be sure to pass this along as a request.

The only workaround right now would be to change the hostname from www.dropbox.com to dl.dropboxusercontent.com. The response on the latter would give a success or failure response code, but this isn't documented so it isn't officially supported.

Sidharth C.
New member | Level 1

Thanks Gregory! This information helped.

Gabriel A.1
New member | Level 1

Gregory can you provide a sample link.

For example:

Will this link  https://www.dropbox.com/s/t0wnpjojvj6g4dx/Dropbox.pdf?dl=0

become

https://dl.dropboxusercontent.com/s/t0wnpjojvj6g4dx/Dropbox.pdf?dl=0

I tried it and is not working.

Greg-DB
Dropbox Staff

What do you mean when you say it's not working? The first version of your link has a 200 code with a 404 page as described earlier in this thread, but the second version of the link does have a 403 code that you can detect programmatically.

In any case, we do have a better way to check links like this now. You can use the API v2 /sharing/get_shared_link_metadata endpoint to get shared link metadata or an error for shared links like this:

https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Gabriel A.1 New member | Level 1
  • User avatar
    Sidharth C. New member | Level 1
  • User avatar
    Rich Super User II
What do Dropbox user levels mean?