issue in import openapi using API Management service with REST client

Oleg Semyonov 21 Reputation points
2020-06-18T17:28:08.84+00:00

I use REST client to create/update APIs

using REST client with https://{myservice}.management.azure-api.net/ xxxxxx?api-version=2018-06-01-preview


it works when we import swagger doc:

PUT operation with body
{
"format": "swagger-link-json",
"name": "my-API-name",
xxxxx
}


but it doesn't when we import openapi: "3.0.1" doc:
PUT operation with body
{
"format": "openapi+json-link",
"name": "my-API-name",
xxxxx
}


result: API is created but operations list is empty

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

1 answer

Sort by: Most helpful
  1. Samara Soucy - MSFT 21 Reputation points
    2020-07-02T15:07:33.777+00:00

    It seems like you may be mixing API versions.

    Version api-version=2018-06-01-preview is deprecated, and open api is not an available option is this version. It uses a content type header of "application/vnd.swagger.doc+json" instead of the "format": "swagger-link-json" property.

    Updating to api-version 2019-01-01 allowed me to import the OpenAPI spec. The APIM management base and authentication stayed the same, but the rest of the format needs to match the standard Azure Management API style https://(resourcename}.management.azure-api.net/subscriptions/{subscriptionid}/resourceGroups/{resourcegroup}/providers/Microsoft.ApiManagement/service/(resourcename}/apis/petstore?api-version=2019-01-01

    From there the format parameter works as expected for both Swagger and OpenAPI;

      {  
        "properties": {  
        "format": "openapi+json-link",  
        "value": "http://petstore.swagger.io/v2/swagger.json",  
        "path": "petstore"  
      }  
    }  
    
    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.