How to import a Postman collection into your Azure API Management

I have been working with API Management (Azure APIM) for a long time, not only playing around with POC and testing new features but actually working and implementing real solutions for clients. I also delivered several API Management talks here in Portugal but I realize that I never wrote a blog post about this topic. That will change today hehe.

OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:

  • Available endpoints (/users) and operations on each endpoint (GET /users, POST /users)
  • Operation parameters Input and output for each operation
  • Authentication methods
  • Contact information, license, terms of use and other information.

API specifications can be written in YAML or JSON. The format is easy to learn and is both human-readable and machine-readable.

This specification is widely used these days, especially in the Microsoft community, but unfortunately, not all of them use it and there are still quite a few APIs that do not expose any kind of specification/documentation like Swagger, WADL or even WSDL (this last for web services).

For REST APIs, I have seen several suppliers/partners use Postman Collections to easily test their APIs by emulating request but also to document the APIs by adding a name and descriptions to requests, sample requests, headers, and other metadata. Performing unit tests in all the operations and sharing them inside their teams.

#1 Azure Monitoring Platform

Postman Collections are groups of requests that can be run together as a series of requests, against a corresponding environment. Using scripts, you can build integration test suites, pass data between API requests, and build workflows that mirror your actual use case of APIs.

import a Postman: Postman Collection Sample

See how to create a Postman Collection here: Creating collections

I have to say, I love Postman but I never used it for that propose, although it is an excellent tool, in my opinion, I believe that to document an API it has some limitations.

And in one of my recent projects the partner delivered me a Postman Collection as a way of documenting their REST API which led me to a “small” problem:

  • I didn’t want to replicate or manually expose the API inside the API Management…
  • and the API Management by default doesn’t allow me to import a Postman Collection

So, how can I import a Postman collection into my Azure API Management?

Fortunately for us, there are several free tools that allow you to convert (or transform) a postman collection (1.0 – 2.0) to formats of your choice that in our case Swagger. And one of these tools is APIMATIC.

For that you just need to:

  • Access APIMATIC API Transformer page: https://apimatic.io/transformer
  • Upload your Postman collection file description
  • Provide a File Description URL
  • And select the desired output format, in our case we selected “Swagger v2.0 (JSON)”
import a Postman: APIMATIC API Transformer Postman Collection to Swagger
  • And finally, click “Convert Now”

The output file will be automatically downloaded into your machine.

import a Postman: APIMATIC API Transformer Postman Collection to Swagger output

Now that I have my swagger file, I can now access my API Management in the Azure Portal and then:

  • From the left pane, select “Add API” and then select “OpenAPI specification” option
import a Postman: Azure API Management Add API
  • Import the file I had created previously in the APIMATIC web tool and click “Create”
import a Postman: Azure API Management Add API OpenAPI

It probably doesn’t do everything for you, you may need to optimize the query parameters or the URL template parameters, but at least this approach will do 90% of the work for you:

import a Postman: Azure API Management Add API OpenAPI result

This approach saved me several working hours on the task of exposing the Partner API in my API Management Portal.

#1 Azure Monitoring Platform
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

3 thoughts on “How to import a Postman collection into your Azure API Management”

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top