Import Swagger file programatically to Azure APIM

Sujith 26 Reputation points
2022-01-07T11:09:38.823+00:00

I am trying to deploy some services to APIM, I am trying to use the APIM "Management API" .
However I couldn't find a way to import the swagger file to the APIM using these Management APIs.
Any suggestions?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,446 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sam Cogan 10,812 Reputation points Microsoft Employee Volunteer Moderator
    2022-01-07T17:10:00.197+00:00

    You need to use the Create/Update API to pass in the URL of your swagger file. You can find an example here


1 additional answer

Sort by: Most helpful
  1. Sujith 26 Reputation points
    2022-01-13T04:36:09.067+00:00

    There is a way to pass the swagger as json text.
    Posting it here , so that it could be helpful for any others.
    Call the APIM management API to create API and pass the below in body.

    {
    "properties": {
    "format": "openapi+json",
    "value": "<<swaggr json text goes here>>",
    "path": "/"
    }
    }

    Please note that format should be "openapi+json" for open api version 3.1 and "swagger-json" for open api version 2.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.