Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
hossein
7 years agoNew member | Level 2
Problem calling API from PHP
I make the authentication step and got the accesstoken as well.
now I want to start an API call so I wrote the below code:
# Include the Dropbox SDK libraries
require_once "dropbox-sdk/Dropbox/autoload.php";
use \Dropbox as dbx;
$accessToken="XXXXXXXXXXXXXXXXXXXXXXX";
echo "Step 1 <br>";
$dbxClient = new dbx\Client($accessToken, "updashboard-test");
echo "Step 2 <br>".var_dump($dbxClient);
$accountInfo = $dbxClient->getAccountInfo();
echo "Step 3 <br>";
var_dump($accountInfo);
it passed Step 1 and 2 but stoped on step 3 and notting desplayed. plese see the below my screen shot:
Step 1
object(Dropbox\Client)#2 (6) { ["accessToken":"Dropbox\Client":private]=> string(64) "XXXXX" ["clientIdentifier":"Dropbox\Client":private]=> string(16) "updashboard-test" ["userLocale":"Dropbox\Client":private]=> NULL ["apiHost":"Dropbox\Client":private]=> string(15) "api.dropbox.com" ["contentHost":"Dropbox\Client":private]=> string(23) "api-content.dropbox.com" ["host"]=> object(Dropbox\Host)#3 (3) { ["api":"Dropbox\Host":private]=> string(15) "api.dropbox.com" ["content":"Dropbox\Host":private]=> string(23) "api-content.dropbox.com" ["web":"Dropbox\Host":private]=> string(15) "www.dropbox.com" } }
Step 2
I canged AccessToken to XXXX on the above codes.
please let me know why it is like this.
1 Reply
- Greg-DB7 years ago
Dropbox Community Moderator
The Dropbox PHP you're using here uses API v1, which is retired, so it will no longer work:
https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/
You'll need to migrate to API v2. We don't have an official PHP SDK for Dropbox API v2, but you can use a third party library:
https://www.dropbox.com/developers/documentation/communitysdks
Or, you can call the HTTPS endpoints themselves:
https://www.dropbox.com/developers/documentation/http/documentation
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!