0

I have backend system in Web API using asp.net core where I am using Swashbuckle.AspNetCore package for generating OpenAPI Specification document. The OpenAPI specification document is generating fine something like '~/swagger.json'. I hookup this url in APIM via OpenAPI specification it works like a charm.

However if the '~/swagger.json' gets updated due to adding new operation,documentation and so on. The changes are not getting reflected in APIM. How can I solve this problem?

If APIM is not able to detect the changes automatically then can I mention the url '~/swagger.json' in ARM template something like that and while doing complete deployment of the APIM for e.g.in other or higher environment the spec gets reflected there. I also tried to download the ARM template from portal I was not able to see a place where I can specify '~/swagger.json' url.

There is option from UI to import spec again but any easy automated way of doing this would be appreciated

akshayslodha
  • 37
  • 1
  • 8

1 Answers1

0

Ues PUT /apis/... call in Azure APIM rest API and specify below as payload:

{
  "properties": {
    "format": "swagger-link-json",
    "value": "https://contoso.com/swagger.json"
  }
}

Docs: https://learn.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/apis/createorupdate#contentformat

Vitaliy Kurokhtin
  • 7,205
  • 1
  • 19
  • 18