We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
Niko H.
11 years agoNew member | Level 1
Set expiration of streamble link via /media
Hey there,
I'm using the Dropbox PHP SDK to create a streamable link via the /media API reference, by calling createTemporaryDirectLink($path) in PHP.
Is there any chance to influence the lifetime of the link I get? Or at least something to doublecheck how long the created link will be available?
Would be awesome!
Thanks in advance,
Niko
12 Replies
Replies have been turned off for this discussion
- Niko H.11 years agoNew member | Level 1
Okay, so I found out myself how to GET the expiration date. A quick look and crawl through the code made me write this little snippet:
$response = $dbxClient->doPost(
$dbxClient->getHost()->getApi(),
$dbxClient->appendFilePath("1/media", $path)
);if ($response->statusCode === 404) return null;
if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);$responseBody = json_decode($response->body);
echo $responseBody->expires;
So I learn, that expiration times are approx 4 hours. Fine! :-)
But can I influence this?Niko
- Steve M.11 years ago
Dropbox Staff
The expiration time is always be 4 hours. There's currently no way to influence the expiration time. Why do you want to do that? Would you want to increase it or decrease it?
- Marjorie B.110 years agoNew member | Level 1
Anyone know how to get the time expires or increase it?
- Marjorie B.110 years agoNew member | Level 1
I would like to increase this average must be left open like 6 months , which in my case is photographs.
- Greg-DB10 years ago
Dropbox Community Moderator
The expiration information for a link from /media is returned in the "expires" key in the response:
https://www.dropbox.com/developers/core/docs#media
It's not currently possible to change that, but if you instead need a longer-lived link, you can use /shares instead:
https://www.dropbox.com/developers/core/docs#shares
Those links don't expire by default, though they can be revoked. They also point to the preview page by default, and not the file content itself, but you can modify them as necessary for that as shown here:
- Marjorie B.110 years agoNew member | Level 1
Unfortunately I will have to use another cloud storage system software for my photo software , as must the link be available , via the share has not as I put the picture gallery within my system.
- Marjorie B.110 years agoNew member | Level 1
The api returns that URL to share https://db.tt/NInRpgMh I need the full Url when you click on that link it opens me this url https://www.dropbox.com/s/hjb603diqqv23hs/1.png?dl= 0 oh yes could use the raw = 1 , because my system is all automated and this minified link not working .
- Greg-DB10 years ago
Dropbox Community Moderator
You can set the short_url parameter to false to get the long URL directly.
- Rafal R.110 years agoNew member | Level 1
I think the only way I see based on your replays is to use:
https://www.dropbox.com/developers/core/docs#shares
to get a gallery view and than use curl and another function to find:
from this page.
- Greg-DB10 years ago
Dropbox Community Moderator
Rafal, it sounds like you mean you'd be scraping the web site. This isn't supported, and is likely to break. (It's also against the terms.)
Instead, if you need a long lived direct link to a file, you should use the method described previously. Call /shares with short_url=false, and modify the link as shown in https://www.dropbox.com/help/201 .
If this isn't what you're trying to do, I recommend opening a new thread with the specifics of your use case/question.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 2 days ago
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 or Facebook.
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!