0
votes

I'm trying to update an APIs schema calling the Azure API management REST API like this:

curl -X PUT -H "Content-Type: application/application/vnd.ms-azure-apim.swagger.definitions+json" -d @service-api.swagger.json  -H "Authorization: Bearer $TOKEN" https://management.azure.com/subscriptions/${subID}/resourceGroups/${groupName}/providers/Microsoft.ApiManagement/service/clientnetdev/apis/${apiID}/schemas/${schemaID}?api-version=2017-03-01

I don't get any response from the API management.

The .json file is in proper swagger format, editor exported, and contains the necessary declarations:

API Management currently supports both 1.2 and 2.0 version of Swagger document for import. Make sure that, even though Swagger 2.0 specification declares that host, basePath, and schemes properties are optional, your Swagger 2.0 document MUST contain those properties; otherwise it won't get imported.

What am I doing wrong?

1

1 Answers

0
votes

Please check the following things in your json swagger schema

  1. In the swagger file add the schema attribute above tags attribute.

  "schemes" : {
"https"
}

2.In the path configuration with POST type, there is an attribute collection called parameters. In the parameters array, there should be only one data with attribute ‘in’ as ‘body’.

   "parameters" :  [{

"in":"body"

},
//invalid
{
"in":"body"
}]
  1. In the generated swagger file, the query parameters won’t have the parameter definition. So add the parameter definition to the parameter array. by specifying in attribute as path.

"parameters" : [{

"in":"param"

},
{

"in":"param"

}]