"Daily Mix" with Postman Monitors and Spotify

This continues from my previous post, Music Discovery with Spotify and Postman and concludes the series Conditional Workflows in Postman.

We last learnt how to make a collection that generates a playlist with music from your favorite artists using the Spotify API. We then ran the collection in the Postman App and Newman.

Today, we're going to take this one step forward and emulate 2 awesome Spotify features for music discovery – Discover Weekly and Daily Mix. And we'll use 2 new features in the Postman Pro arsenal to do this – Postman Monitors and the Postman Pro API.

Postman Monitors, launched in January 2017, lets you check for the performance, uptime and correctness of your API. It's built on Postman Collections running on the cloud on a specified schedule.

The Postman Pro API exposes several endpoints to help you integrate Postman more deeply with your development toolchain. Using the API, you can create and update collections and environments, and run monitors, simultaneously syncing each action with your Postman app. All new features (e.g. Postman Mock Service) will be launched first via the API before making their way into the app.

As you would have guessed by now, we'll use Postman Monitors to run our simple yet effective music discovery collections once a day (or week) on the cloud.

Quickly jotting down the workflow:

  1. Add a new request to our collection which updates the environment at the end of the run using the Postman Pro API. This allows us to emulate the Persist Variables feature in the app.
  2. Create a monitor with the updated collection and environment.

This is what our updated workflow looks like:

Click the Run in Postman button below to get the collection and environment into your Postman app.

Run in Postman

Create the Monitor

  1. First, make sure you run the collection in the app with the new environment template. You'll have to set up the environment as explained in the previous post.
  2. Now head to the Postman Monitors. If you're not already on Postman Pro, you can start a free trial.
  3. Create a new monitor selecting the downloaded collection and environment template. In the screenshot, I've set it to run every morning at 9AM.
  4. Go to the details view, and you'll see this screen
  5. Click on the Run Now button (next to Edit Monitor) to check if everything works fine.
  6. Finally, after a few manual or scheduled runs, your monitor results should look something like this!

Since we're using the Postman Pro API to update the environment in the final request, we constantly expand our list of artists as shown below. Personally, I have discovered entirely new and obscure genres using this monitor!

I hope you found this series to be useful and an insight into the hard work we're putting into making Postman Pro the most comprehensive toolchain for API developers. Stay tuned for similarly fun use cases of the Postman ecosystem.

Author: ankit

Founder and CTO | Postman