Reputation: 1531
I know that it's supposed to go in the request body, but how does it fit in with the rest of the metadata? What's the NAME part of the name/value pair for the actual swagger text? I'm trying to import a swagger documentation into Azure API Management by passing in a string representation of the swagger doc. According to the documentation below, the "Content-Type" should be set to "application/vnd.swagger.doc+json" and the "import" query parameter should be set to "true". However, there is nothing in the documentation that specifies where this "import" parameter should go. Here is the PUT example that Microsoft provides:
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?api-version=2016-10-10
Is there an example that shows how to pass in the swagger string along with all the other required parameters in the body?:
Upvotes: 1
Views: 686
Reputation: 7795
To import swagger file you need to make a PUT call at
https://.../apis/{desired-api-id}?path={desired-api-path-suffix}&import=true&api-version=...
Swagger content should go as is into request body, without any encoding. Various pieces of information from swagger will be used to fill in the API details, it's only path that has to be explicitly passed in query as it just can't be found there.
Upvotes: 2