Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
John D.24
10 years agoNew member | Level 1
PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256
I've been using the PHP SDK to save files programmatically for well over a year without issue. However, just in the past few days a problem suddenly appeared that is throwing a fatal error. I have updated the SDK with the current dropbox-sdk-php-1.1.6 files, with no change.
The error occurs as I make a call to
$dbxClient->createShareableLink($objFile->fileFolder);
PHP Fatal error: Uncaught exception 'Dropbox\Exception_BadResponseCode' with message 'Unexpected HTTP status 301
' in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php:256
Stack trace:
#0 /~application~/includes/dropbox-sdk/Dropbox/Client.php(1034): Dropbox\RequestUtil::unexpectedStatus(Object(Dropbox\HttpResponse))
#1 /~application~/uploadFile.php(124): Dropbox\Client->createShareableLink('//WGASC/Alvarad...')
#2 {main}
thrown in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php on line 256
Again - this has been working just fine for months until the last few days (<1 week).
Anyone have an idea of what's going on ... and how to resolve?
Thank you in-advance.
-john
6 Replies
Replies have been turned off for this discussion
- Steve M.10 years ago
Dropbox Staff
You mentioned uploadFileFromString, but it looks like the error is coming from createShareableLink?
Also, I notice that the path you're passing to createShareableLink has an extra leading slash. My guess is that this is the culprit... try getting rid of that leading slash to see if the problem goes away.
- John D.2410 years agoNew member | Level 1
NOTE: I removed the additional '/' from the beginning of the folder name and the problem was resolved. What is strange is that the double '/' has been working for months.
- Steve M.10 years ago
Dropbox Staff
My guess is that something changed on the Dropbox side to redirect paths with double slashes in them. (E.g. /foo//bar gets redirect to /foo/bar.) I'll make sure the right folks take a look at this.
- Pankaj G.10 years agoNew member | Level 1
This created a huge problem with our integration and we were scratching our head what is wrong. Finally landed here and now know the issue. Is there a way for drop box to inform the community when something of this sort changes? Lot of time gets wasted otherwise
- Greg-DB10 years ago
Dropbox Community Moderator
Apologies for the inconvenience Pankaj! We of course never want to break apps, and we email and post on the blog whenever we are planning a breaking change or deprecation. This change in validation wasn't intended to be a breaking change though, so there wasn't any outreach.
- Greg-DB10 years ago
Dropbox Community Moderator
For reference, we've now reverted the behavior change, so the double slash version should work again. We do recommend only using a single slash though.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!