Thursday, February 1, 2018

Discussion: ASP.NET Core Versioning

I've been studying ASP.NET Core for a couple of weeks now, my goals are to build a web API that interect with my SPA and expose some services for external acess. At this moment I'm interested in knowing a little bit more about versioning my resources, and some doubths came up:

  • 1) What it's the best versioning approch in your point of view (Url / Headers / Query Param)?

I feel like URL approch it's a good solution, but would turn out very verbose.

Url example, using {ver:apiVersion}:

[ApiVersion("1.0")] [Route("api/v{ver:apiVersion}/itens")] [ApiVersion("2.0")] [Route("api/v{ver:apiVersion}/itens")] 

Header example (cleaner):

[ApiVersion("1.0")] [Route("api/itens")] [ApiVersion("2.0")] [Route("api/itens")] 
  • 2) What's file/folder structure strategy would you choose?
  • 3) Should we control our version for each resource or have a global version?

Global example, where we have ONE current version for all features:

api/v2.0/clients --> same behaviour of api/v1.0/clients api/v2.0/itens --> breaking changes from api/v1.0/itens 

Resource approch. Different versions for each resource:

api/v1.0/clients api/v2.0/itens 
Discussion: ASP.NET Core Versioning Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team