cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

How to detect an invalid share URL?

New member | Level 1
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
Highlighted

Re: How to detect an invalid share URL?

Super User II
Super User II

Moved to the API forum.

Highlighted

Re: How to detect an invalid share URL?

Dropboxer
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.

Highlighted

Re: How to detect an invalid share URL?

New member | Level 1
New member | Level 1

Thanks Gregory! This information helped.

Highlighted

Re: How to detect an invalid share URL?

New member | Level 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.

Highlighted

Re: How to detect an invalid share URL?

Dropboxer
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

 

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?