cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Whether you are transferring a single drive, a team or an entire organization, Movebot's cloud migration tool has been built to make your Dropbox migration simple - learn all about it 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: 

To get Download able URl

To get Download able URl

bhuwan
Explorer | Level 3

I have try to use the way I was told in my previous ticket.

try{
$client->request('POST', config('providers.providers.dropbox.create_shared_link'),
[
'headers'=>
[
'Authorization'=>'Bearer '.$acc_token,
'Content-Type' => 'application/json',
],
'body'=>json_encode($parameters)
]);
}catch(ClientException $exception){
$url = json_decode($exception->getResponse()->getBody(), true)['error']['shared_link_already_exists']['metadata']['url'];
$url = str_replace('dl=0', 'dl=1', $url);
return $url;
}


 However, sometime endpoint is not responding anything either in call or exception. Need to solve this issue. 

2 Replies 2

Re: To get Download able URl

Greg-DB
Dropboxer

Looking at your code, a few things come to mind:

  • You're always calling `json_decode` in the exception handler, assuming the error response is always JSON, but this isn't necessarily true. (It can be plain text, for instance.) You should first check the response's Content-Type header value to determine the type of the response. 
  • You're only catching `ClientException`, however there might be other kinds of exceptions. (I can't provide support for the client you're using though, so I can't say for sure.)
  • You may be running in to an issue with your network connection. Is there any firewall, proxy, anit-virus, etc. on your network connection that may be interfering?

In any case, I recommend stepping through with a debugger to see exactly where code execution is going. If you're getting any unexpected error or output from the Dropbox API itself, share it here so we can look into it.

Re: To get Download able URl

Здравко
Super Collaborator | Level 20

Hi @bhuwan,

In your code shared link existence is expected! Right? What about if such link don't exist yet and is just created?! :thinking: :wink:

Hope this gives some direction.

Who's talking

Top contributors to this post

  • User avatar
    Здравко Super Collaborator | Level 20
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?