@Dibya Ranjan Tripathy Assuming that you are replicating the same behavior that the portal does when you add a new revision set on any of your existing API then you need to call the below APIs. You can also collect the F12/fiddler traces to know what calls are initiated from the Azure portal.
got 201 responses from the rest API call but versionset is not reflected in azure APIM in api sections.
The create API version set only creates the version set and doesn't associate with any of the API that is the reason you are not able to see it in the API section on your APIM instance. To see the API and operation you need to execute below API as it is initiated from portal to replicate the same behavior.
https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/api-version-set/create-or-update (Only creates the version set and it will not be associated with any API)
PUT /subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ApiManagement/service/{apiminstance}/apiVersionSets/{versionsetID}?api-version=2021-04-01-preview
{
"id":"/apiVersionSets/{versionsetID}",
"properties":{
"displayName":"{displayname}",
"versioningScheme":"Segment"
}
}
https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/apis/create-or-update
PATCH /subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ApiManagement/service/{apiminstance}/apis/{apiID}?api-version=2021-04-01-preview
{"properties":{"apiVersionSetId":"/apiVersionSets/{versionsetID}"}}
https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/apis/create-or-update
PUT /subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ApiManagement/service/{apiminstance}/apis/{apiID}-{name};rev={number}?api-version=2021-04-01-preview
{
"properties":{
"sourceApiId":"/subscriptions/{subscriptionID}/resourceGroups/{resourcegroupname}/providers/Microsoft.ApiManagement/service/{apiminstance}/apis/{apiID}",
"apiVersion":"new",
"apiVersionSetId":"/apiVersionSets/{versionsetID}",
"apiVersionSet":{
"versioningScheme":"Segment",
"name":"{anyname}"
}
}
}
Please let me know if I misunderstood your requirement and please share more details.