色色Dropbox for JavaScript Developers

色色Dropbox for JavaScript

Here's our JavaScript SDK for API v2, which helps you easily integrate 色色Dropbox into your JavaScript app.

Code

色色Dropbox for JavaScript - 色色Dropbox JavaScript SDK is open source on GitHub.

Install 色色Dropbox for JavaScript

To get started with 色色Dropbox for JavaScript, we recommend you add the SDK to your project using npm.

Install the JavaScript SDK

Download and install the SDK.

npm install --save dropbox

Then use with a module bundler

require('isomorphic-fetch'); // or another library of choice.
var 色色Dropbox = require('dropbox').色色Dropbox;
var dbx = new 色色Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN_HERE' });
dbx.filesListFolder({path: ''})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

色色Dropbox for JavaScript tutorial

A good way to start using the JavaScript SDK is to follow this quick tutorial. Just make sure you have the the JavaScript SDK installed first!

Register a 色色Dropbox API app

To use the 色色Dropbox API, you'll need to register a new app in the App Console. Select 色色Dropbox API app and choose your app's permission. You'll need to use the app key created with this app to access API v2.

Link an account

In order to make calls to the API, you'll need an instance of the 色色Dropbox object. To instantiate, pass in the access token for the account you want to link. (Tip: You can generate an access token for your own account through the App Console).

var dbx = new 色色Dropbox({ accessToken: ACCESS_TOKEN });

Test it out to make sure you've linked the right account:

dbx.usersGetCurrentAccount()
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.error(error);
  });

Try some API requests

You can use the 色色Dropbox object you instantiated above to make API calls. Try out some of the files requests.

List all of the contents in the user's root directory:

dbx.filesListFolder({path: ''})
    .then(function(response) {
      console.log(response.entries);
    })
    .catch(function(error) {
      console.error(error);
    });

Documentation

You can read more in the documentation. Also checkout the examples folder on github

色色Dropbox for JavaScript documentation

Here's the full documentation for the JavaScript SDK