Yeah, you can do that (a bit of a hack). You have to use REST Api for that, specifically this call. For me it didn't work to edit the existing API (they key was still there), but when I've created new API, key wasn't there:
I had to blur out all my stuff, sorry about that. So to achieve that, you would want to issue the following query:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?api-version=2016-07-07&import=true&path={APIpostfix} Headers:
Authorization = "Bearer TOKEN_GOES_HERE" ## Space after 'Bearer' is mandatory
Content-Type = "application/vnd.swagger.link+json" ## Look for the proper "Content-Type" on the page I've linked. This is the example to import API definition directly from "swagger.json" generated by your running api.
Authorization = "Bearer TOKEN_GOES_HERE" ## Space after 'Bearer' is mandatory Content-Type = "application/vnd.swagger.link+json" ## Look for the proper "Content-Type" on the page I've linked. This is the example to import API definition directly from "swagger.json" generated by your running api. Body:
{ "name": "Name", "description": "Desc", "link": "http://url.to/your/swagger.json", ## <<only needed if you import directly from running API "serviceUrl": "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/backends/{APIpostfix}", ## << declare your API Management backend "protocols": [ "https" ], "authenticationSettings": { "oAuth2": null, "openid": null }, "subscriptionKeyParameterNames": { ## << Magic happens here "header": null, "query": null } } PS. I've never bothered to figure out PUT + Send over the swagger file, but I'm sure its pretty straight forward when you know this.
