TheDude TheDude - 1 year ago 36
reST (reStructuredText) Question

Is it possible to import swagger API into APIM from an authenticated source?

We have swagger docs that require authentication to get at them. I'm aware of how to import swagger docs from a url into APIM via REST API or PowerShell commandlet, however, I would need to be able to somehow pass in an authentication token so that I can get to the swagger docs that require authentication. Is this possible with APIM REST API or PowerShell commandlets?

If it's not possible to authenticate through the APIM REST API, is it possible to simply pass in the swagger definition as a string? I've only seen the possibility to import via file or url using the powershell commandlet.

Answer Source

It is not possible to make APIM pass some credentials while fetching swagger, but if you get it youself (or via script) it's sure possible to just send it to APIM to import. See here https://docs.microsoft.com/en-us/rest/api/apimanagement/apis#Apis_CreateOrUpdate.

PUT request with Content-Type: application/vnd.swagger.doc+json would imply that the body of request contains swagger document. So if you can fetch document before hand and send it in PUT request everything should work fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download