Importing Postman Collections to Create API Monitors

Postman is a platform that enables you to construct API requests and workflows, test integration suites, document your work, and share your finished product with your team and others. The fundamental building block for a Postman application is a “collection” — which consists of one or more API requests, and scripted actions based on the response each request returns.

Postman is available as a Chrome app, but the Postman team recommends the more powerful native apps, which are available for Mac, Windows, and Linux (Beta). In this post, the examples I present use the Windows native Postman app. I downloaded this from the Postman Apps page, ran the installer, and launched the Postman application:

postman-appNow we’re ready to use the Postman Builder to create a request.

Let’s say we’d like to query the World Bank’s Countries API for information about Canada. The World Bank Countries API supports two- and three-letter ISO codes. The two-letter ISO code for Canada is CA. Based on this, we can create a World Bank Countries API GET request using this URL:

http://api.worldbank.org/countries/ca

Entering this into the Postman “Enter request URL” field and clicking the “Send” button produces this result:

postman-world-bank-ca-response

The GET query succeeded: the World Bank Countries API responded by sending the information about Canada, including region, income level, capital, etc.

Let’s assume your company’s product is focused on providing information about the state of the Arctic Ocean, and you use the World Bank information about the nations that have coastlines on the Arctic Ocean. How can you know when that information is available, and when it is not available? If the World Bank Canada information is not available, your product/app may appear “down” to your users. In any case, if this API is a component of your product, you will want to know when, and how often, the API is down, or when its performance is poor.

This is the type of information that is provided to you by your API Science account.

So, having successfully created your Postman test request, can you turn this into an API Science monitor?

Yes!

First, let’s click that “Save” button on the Postman result window. This results in a pop-up that lets us enter a description of this request and either add it to an existing Postman “collection” or create a new one:

postman-world-bank-new-collection

In this case, I’m creating a new Postman collection named “World Bank Arctic Countries.” Clicking the “Save” button accomplishes this.

Next, you can export your Postman collection. From our Collections tab, we click the “…” next to our “World Bank Arctic Countries” collection, and this raises a pull-down menu that includes an “Export” option that lets us save our Postman collection to a file:

postman-collection-export-menu

Now, go to your API Science Dashboard, click “Import” at the top of the page, then click the “Import From Postman” button:

postman-import

In this case, we exported our Postman collection to a file. So, we click the “Import from File” tab then click the “Browse” button:

import-postman-file

Select the file you exported from Postman, and click the “Create Monitors” button:

postman-import-create-monitors

This brings us to our API Science Dashboard, which now includes the new monitor GET http://api.worldbank.org/countries/ca (the monitor name is editable). Clicking on the monitor brings up our first check page:

postman-import-first-monitor-check

We’ve now created an API collection in Postman, imported it into your API Science account, and created a monitor that will let you assess this API’s performance and uptime, and alert your team should the API go down.

–Kevin Farnham