Export API definition to Postman for API testing and monitoring

APPLIES TO: All API Management tiers

To enhance development of your APIs, you can export an API fronted in API Management to Postman. Export an API definition from API Management as a Postman collection so that you can use Postman's tools to design, document, test, monitor, and collaborate on APIs.

Prerequisites

  • Complete the following quickstart: Create an Azure API Management instance.

  • Make sure that your instance manages an API that you'd like to export to Postman.

    Note

    Currently, you can only export HTTP APIs from API Management directly to Postman.

    For testing authorization in Postman as outlined later in this article, the API should require a subscription.

  • A Postman account, which you can use to access Postman for Web.

Go to your API Management instance

  1. In the Azure portal, search for and select API Management services.

    Select API Management services

  2. On the API Management services page, select your API Management instance.

    Select your API Management instance

Export an API to Postman

  1. In the portal, under APIs, select an API.

  2. In the context menu (...), select Export > Postman.

    Screenshot of exporting an API to Postman in the Azure portal.

  3. In the Run in dialog, select the Postman location to export to. You can select the option for the desktop app if you've installed it locally.

  4. In Postman, select a Postman workspace to import the API to. The default is My Workspace.

  5. In Postman, select Generate collection from this API to automatically generate a collection from the API definition. If needed, configure advanced import options, or accept default values. Select Import.

    The collection and documentation are imported to Postman.

    Screenshot of collection imported to Postman.

Authorize requests in Postman

If the API you exported requires a subscription, you'll need to configure a valid subscription key from your API Management instance to send requests from Postman.

Use the following steps to configure a subscription key as a secret variable for the collection.

  1. In your Postman workspace, select Environments > Create environment.

  2. Enter a name for the environment such as Azure API Management.

  3. Add a variable with the following values:

    1. Name - apiKey
    2. Type - secret
    3. Initial value - a valid API Management subscription key for the API
  4. Select Save.

  5. Select Collections and the name of the collection that you imported.

  6. Select the Authorization tab.

  7. In the upper right, select the name of the environment you created, such as Azure API Management.

  8. For the key Ocp-Apim-Subscription-Key, enter the variable name {{apiKey}}. Select Save.

    Screenshot of configuring secret API key in Postman.

  9. Test your configuration by selecting an operation in your API such as a GET operation, and select Send.

    If correctly configured, the operation returns a 200 OK status and some output.

Next steps