azureapim

APIM API URL Suffix


Good afternoon. I am using Azure APIM on a new project. It will contain 2 related APIs for products and services. My problem is I want them to share the same URL suffix

https://Azure.APIM/MyProject/services

https://Azure.APIM/MyProject/products

However when I go to create the products I get an error saying I cant use the same suffix unless they're in a version set.

I added my services API to a version set using v1 (instead of MyProject) as the version. It seemed to work as it put the API under a version in the left hand nav, but when I try to create the products API I still get the same error even though I (think) I'm specifying the version correctly creating the new API.

To ask it another way, is there any way 2 APIs can use / as the suffix if they somehow belong to the same version set?


Solution

  • The thread reference which chrisbuttacavoli shared talks about creating one main API (e.g. MyProject) and adding multiple operations (services, products) as paths under this API i.e. /organisations/{orgId}/users, would be added as an endpoint within the single API.

    If you want two APIs in APIM to share a common URL suffix (like /MyProject/services and /MyProject/products), you’ll need to use an API Version Set.

    Under your APIM instance, add your first API i.e. services. Under version set, choose whatever name you gave for your version set -> Set API URL suffix to services -> give the version identifier (e.g v1) -> configure other details and create

    Once it's up you should see your service api url

    https://arkoAPIM1.azure-api.net/MyProject/v1/services
    

    enter image description here

    Same way do for second API products

    https://arkoAPIM1.azure-api.net/MyProject/v1/products
    

    Now it is upto you which solution suits you better. if you need separate versioning and version control for each endpoint and flexibility to manage each API independently then use api version set.

    if you need simple API structure with common parameters, like {orgId} across all operations then go for the one which
    chrisbuttacavoli
    suggested.

    Reference-

    MS doc on how to use version sets