From the course: Advanced Web APIs with ASP.NET Core 8
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Using the Accept header for versioning - ASP.NET Core Tutorial
From the course: Advanced Web APIs with ASP.NET Core 8
Using the Accept header for versioning
- [Instructor] I already mentioned that we could also use the Accept HTTP header for version information and I'd like to show you now how this could be done. And this also allows me to introduce another feature I already briefly mentioned. We can have different ApiVersionReaders and this is how this works. We can use a static method called ApiVersionReader.Combine, which combines several ApiVersionReaders and they will be used one after the other. And as soon as one of those readers returns an API version, ASP.NET Core stops and is using that version number or version identifier. I would like to keep the header ApiVersionReader, but I'd like to use a second one, the MediaTypeApiVersionReader because when we use the Accept HTTP header, we are providing the MediaType we accept in that API call as the data being returned. In that Accept header, we usually have something like */* or application/json and then we can append the version information. We have to tell ASP.NET Core how we are…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Introduction: API versioning29s
-
(Locked)
Versioning options2m 54s
-
(Locked)
NuGet versioning packages2m 54s
-
(Locked)
Implementing URL versioning9m 12s
-
(Locked)
Implementing header versioning3m 51s
-
(Locked)
Using the Accept header for versioning2m 40s
-
(Locked)
Implementing query string versioning2m 12s
-
(Locked)
Versioning minimal APIs7m 58s
-
(Locked)
Versioning and Swagger4m 14s
-
(Locked)
-
-