cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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

Re: How to detect an invalid share URL?

Rich
Super User II

Moved to the API forum.

Re: How to detect an invalid share URL?

Greg-DB
Dropboxer

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.

Re: How to detect an invalid share URL?

Sidharth C.
New member | Level 1

Thanks Gregory! This information helped.

Re: How to detect an invalid share URL?

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.

Re: How to detect an invalid share URL?

Greg-DB
Dropboxer

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

 

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • 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?
Need more support?