

The most commonly used versioning, in which we can add a version (e.g., number) to the API base URL. Version MechanismsĪn easy to implement but difficult to maintain solution in both consumers (clients) and server code. It is important to note that the decision of the versioning mechanism influences the use of client caching and HATEOAS. The following table shows several versioning mechanisms that we can use to provide versioning in our Web APIs. Finally, we will use Postman to perform API requests for the examined versioning mechanisms. Furthermore, we will see two strategies to organize our controller actions and code files. In this article, we will learn the most commonly used versioning mechanisms and how we can apply them in our Web APIs by using. Tip: In the case of SPAs, different released versions can coexist on the consumers. However, we should decide carefully how many versions we will serve and maintain and how we will deprecate them. In such a case, we can provide major versioning not to break or replace already deployed components. In a very interesting interview ( Fielding R.T., 2014), he provides additional information about versioning and HATEOAS in Web APIs.įrom my point of view, the main question to recognize the need for versioning (Major) in a Web API is if the old consumers can coexist with the new ones.
#Asp net core versions how to
The advice of Roy Thomas Fielding (creator or the REST architectural style on how to approach versioning in Web APIs is “ Don’t” ( Fielding R.T., 2013). Supporting and maintaining multiple implementations of the Major versions of our APIs is a way to control how old consumers coexist with new ones.

#Asp net core versions Patch
The consumers can request a specific API version by defining the version in the URI, query-string, HTTP header, or media type.Īs we can understand, serving and maintaining multiple implementations of the Minor and Patch versions are not practical for Web APIs because they are backward compatible (assuming we are using the Semantic versioning). That is because multiple implementations (and versions) of the Web API (including their dependencies, e.g., third-party systems, databases, etc.) should be maintained and be available to the consumers. Providing versioning in Web APIs (i.e., services) is more complex in compassion to API libraries (e.g., NuGet libraries).
#Asp net core versions install
Step 1: Install the Versioning Package Reference.

Apply Versioning at Existing ASP.NET Core Web API Project.
