From the course: Advanced Web APIs with ASP.NET Core 8

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Versioning minimal APIs

Versioning minimal APIs

- [Instructor] We have been relying on controller based APIs so far. But of course, the APO net core, API versioning package also cooperates with minimal APIs. And I'll show you how this can be achieved in the most simple way. We leave the configuration as is. So we accept a query string, API version reader, so an API version in the query string. We accept a specific HTTP header, XAPI version and we also accept a version number in the accept HDP header. So that stays exactly the same. We just have to go to the definition of our minimal API, which is conveniently located in here. And basically what we are doing now is we once again create a copy of the slash products endpoint, and I just copy everything here just for the sake of demonstrating you the functionality. So we have now defined the slash products endpoint twice and we already get that warning here, that there is a conflict. Well, how do we resolve that conflict? There are two steps which we need to take. We first have to…

Contents