[IApiVersionCollection ] How to access api endpoint that has same route but has 2 versions

Hi,

It’s my first time to implement multiple versions of api endpoints via IApiVersionCollection and this is what my test code looks like.
image

I can perfectly access the Version 1 using the specified route in the code:
/headlessapi/test/testget

But how do I access the Version 2? What endpoint should I use?
Tried adding v2 like this below:
/v2/headlessapi/test/testget
/headlessapi/test/v2/testget

but it is not working as expected.

Please advise.

Best regards,
John

Litium version: 7.6.1

the api-version need to be passed into the endpoint as either an http header or querystring parameter, example /headlessapi/test/testget?api-version=2.0.

Also in the definition for the test-collection you can define the default version of the endpoints that should be used if the api-version information is missing in the request.

The ApiVersionLimiter-attribute that will make the specific endpoint limited to a specific version can be set as null, example [ApiVersionLimiter("2.0", null)] if introduce a new endpoint in version 2 but it should continue to work in version 3 and forward.

1 Like

Got it to work now. I was looking for a documentation for this but could not find one. Thanks for the help!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.