How to Start Using the Dropbox API
Learn how to sign up and create an application to use the Dropbox API.
We'll cover the following
In this lesson, we’ll look at the sign up process for Dropbox and how to create an application that will communicate with a Dropbox account.
- A Dropbox account is required.
- Python 3.x is required. We’ll use Python version 3.8.
Feel free to use an existing Dropbox account if you have one. If you don’t, visit the Dropbox Registration Page to create a new account.
Note: You can also use the Dropbox desktop application to monitor changes. Python installation is not required on Educative’s platform, but it’s required if you want to try Dropbox APIs on your local machine.
Create a Dropbox application: A walk-through
Let’s create an application so we can start to use the Dropbox APIs.
- First, visit the Dropbox developer portal and click “Create apps.” This will redirect us to create a new application wizard.
- Here, we’ll see a couple of options, as shown in the second slide below.
- The first option is “Choose an API.” Let’s select “Scoped access.”
- After that, “Choose the type of access you need” will expand. Select the “Full Dropbox” option.
- The “Name your app” section will expand, which will allow us to give our application a name of our choosing.
- Now, click the agreement checkbox, and click the “Create app” button at the end.
After we have created our application, we’ll be redirected to its App Console page. Here, we have all the information related to our application. We’ll then grant permissions to our application so it can communicate with Dropbox without any restrictions.
Follow the steps below to grant permissions:
- Navigate to the “Permissions” tab in the App Console.
- Check all permissions under “Individual Scopes.”
- Click “Submit” at the bottom of the page.
Now that we’ve given permissions to our application, let’s explore some of the important properties from the “Settings” tab:
- Status tells us the current status of our application. By default, it’s set as Development, which limits the users who can access our application. It can also be set as Production.
- Permission type provides information about the permissions granted for our application. We selected “Scoped access” when we created our example application, so we’ll see “Scoped App” as the permission type. If we also select “App folder” as the access type, we’ll see “Scoped App (App Folder)” here instead.
- App key/App secret are unique identifiers for our application, which are used for authorization purposes.
- OAuth 2 -> Generate access token is an API token that is used to authorize API calls to the endpoints. Click the “Generate” button, as shown in the image below, to get the access token.
Note: The above-generated token is temporary. We’ll be required to generate a new token every four hours.
Save the API key
Click “Edit” in the widget below and paste the access token in the TOKEN
field.
print ("Your access token is {{TOKEN}}")print ("The base URL for the Dropbox API is https://api.dropboxapi.com/")