From the course: Advanced ASP.NET Web API 2.2

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Query string versioning

Query string versioning

From the course: Advanced ASP.NET Web API 2.2

Start my 1-month free trial

Query string versioning

- [Instructor] When we use query string versioning, what we do is that we add a string parameter to the query string. We do so to find the controller or action to which we want to send the request. So, for example, let us say we have the API Students API endpoint, and then, if we want to execute the first version, then we write just a question mark, V1. In this case, a JSON response containing the results of the first version is going to be returned. And when we have question mark, V2, it means that a JSON response that comes from the second version of the API is going to be returned. So let us now go to Visual Studio and see how we can implement query string versioning. To be able to use query string versioning, we need to create a custom controller selector. So, based on the query string parameter, we can decide which controller to use. Let's go to the Solution Explorer. Let us create in here a new folder, so Add, New…

Contents