It’s my first time to implement multiple versions of api endpoints via IApiVersionCollection and this is what my test code looks like.
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
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.