APIs only need to be up-versioned when a breaking change is made. Breaking changes include: a change in the format of the response data for one or more calls. a change in the request or response type (i.e. changing an integer to a float)
xxxxxxxxxx
public void ConfigureServices(IServiceCollection services)
{
services.AddApiVersioning(options =>
{
// if we don't specify an api version, assume the default versioon is 1.0
options.DefaultApiVersion = new ApiVersion(1, 0);
// specify where to read the version number from
options.ApiVersionReader
= new MediaTypeApiVersionReader();
// if api version is not specified assume default version to be the one we specified earlier
options.AssumeDefaultVersionWhenUnspecified = true;
// so that we can get an api version information in the responses
options.ReportApiVersions = true;
options.ApiVersionSelector
= new CurrentImplementationApiVersionSelector(options);
});
}