There are lots of file hosting solutions out there, but few things compare to Dropbox because of its simplicity, auto-sync feature, cross-platform support and other cool features.
As a PHP developer you can even take advantage of their API in order to create apps that use its full capabilities. In this article, you'll learn how to build one such app to perform different operations in a user's Dropbox account. You will be using the Dropbox API version 2 in this tutorial. If you want to follow along, you can clone the project from Github.
Creating a Dropbox App
The first thing that you need to do is go to the Dropbox's developer site and create a new app.
Dropbox offers two APIs: the Dropbox API which is the API for the general public and the Business API for teams. These two APIs are pretty much the same, the only difference being that the business API is specifically used for business accounts, so team features such as access to team information, team member file access and team member management are baked into it by default. We'll use the former.
Once you've created the app, you'll see the app settings page:
From here you can set the following:
- Development users - this allows you to add Dropbox users for testing your app. By default the status of the app is development. This means that only you can test its functionality. If you let any other user access your app, they won't be able to use it.
- Permission type - this is the setting that you have selected earlier when you created the app. There are only two permission types: folder and full dropbox. Folder means that your app only has access to the folder that you specify. Full Dropbox means that your app has access to all the user's files.
- App key and secret this is the unique key that's used by Dropbox to identify your app. We'll need this later.
- OAuth2 redirect urls - this is where you can set URLs to which your app can redirect right after the user has approved the necessary permissions. Leave this blank for now, you will be adding a value to it later. For now, take note that only the URLs that you have specified here can be used for redirection.
- Allow implicit grant - whether or not to automatically generate an access token once the user has granted the necessary permissions to your app. If you're making use of Dropbox in the client-side, this should be set to allow so that you can get an access token through JavaScript. For the purpose of this project, you should set it to disallow.
Continue reading %Build Your Own Dropbox Client with the Dropbox API%
by Wern Ancheta via SitePoint
No comments:
Post a Comment