Dropbox has more than 500,000 teams using Dropbox Business collaboration capabilities. The rich Dropbox API allows business customers to manage their content and their team programmatically.
Although Dropbox Business has a web-based management console, some Dropbox team administration tasks, such as onboarding/off-boarding users, are carried out more efficiently through the API. For example, when you need to remove a number of members from the team, running a script is much faster than manually removing each one.
Certain administrative tasks are carried out by combining multiple API requests, executing them sequentially or in conditional loops. We were looking for a way to show how to implement these workflows with the Dropbox API in a format that they could be easily executable, but also extendable, so they can be improved as business needs change.
Enter Postman, an API Lifecycle Platform that has more than 10 million registered users. It is a smart way of learning a new API. It has many capabilities, among them the ability to create collections of requests, run scripts before and after issuing requests and executing multiple requests in sequence. It also has an API Network, where companies can publish their collections of endpoints and expose their public APIs to a large population of developers and administrators.
Combining the ability to sequence requests and publish collections, Postman seemed like a great platform to build and distribute administrative workflows our customers have been requesting. We built the first version of the Dropbox Team Admin Workflows collection during this year's Hack Week, our company-wide annual hacking event. Our team of technical architects, experienced in supporting large Dropbox deployments, had already been using Postman to help customers. We used that customer feedback to define the workflows in the collection. These are some of the workflows you'll find:
- Bulk Provision Users and Add to Groups
- Bulk Deprovision Members with Transfer Destination
- Bulk Deprovision Members without Transfer Destination
- Bulk Suspend Members
- Bulk Unsuspend Members
- Bulk Add Users To Groups
- Bulk Update Email Addresses
- Bulk Add Groups
- Wipe External ID
- Bulk Update External IDs
Let's have a look at the collection. The picture below is the Dropbox page in the Postman API Network:
To add the collection from Postman, go to the Dropbox Team Admin Workflows and click the “Run In Postman” button:
After you import the collection, we recommend you check out the documentation by clicking the ellipsis and selecting “View Documentation”:
In order to try it out in your own Dropbox team, you'll need to provide the credentials. In the documentation, you will find instructions on how to get your access token from your Dropbox account and add it to the collection.
Each workflow in this collection is a folder and can be executed using Postman's Collection Runner. To run a particular workflow, select the folder and click the “Run” button to invoke Collection Runner:
When you point Collection Runner to a folder, it executes requests sequentially according to their order in the folder, or you can use scripts to define your flow.
We use Postman variables to store data in between requests. Postman has several variable scopes available, from local to global. We mostly used collection variables for this collection. It is the least privileged scope that allows us to pass values between requests.
Using Postman's Tests scripting engine, you can access these variables. You can also build workflows by jumping to a different request or even doing a conditional loop. This is done using the setNextRequest() method. Let's take a look at a sample script from the collection. Notice how a simple if-else statement can invoke different requests based on the response you get from the Dropbox API endpoint:
The scripting language that Postman uses is based on Node.js. We recommend reading Postman’s scripting documentation. We believe that pretty soon you'll be modifying our scripts or creating new ones to fit your needs. The Team Admin Workflows collection is already in use by customers and helping administrators manage their teams.
For a more comprehensive look at team administration using the Dropbox Business API, we recommend reading our Dropbox Team Administration Guide. To dig deeper into using the API for sharing in a team context, then we recommend the blog post, Manage Team Sharing in your Dropbox App.
Another exciting feature of Postman is the recently launched Public Workspaces. With Public Workspaces, teams can collaborate with external users on their collections. Head over to the Dropbox Public Workspace in Postman to find the Team Admin Workflows and other collections.
We intend to explore Postman further by releasing other collections, such as showing common operations with the user API. We hope you take the time to explore what our Postman collections can do. If you have coding skills, you can even create your own workflows or improve the existing ones. Go ahead and fork the collections, make pull requests, and help us make them better. Then head over to our Developer Forum and let us know what you think. We look forward to hearing your opinion!