Hacker News new | ask | show | jobs
by mehrdadn 2529 days ago
Funny thing is here I am wondering why he didn't pass a query parameter instead of altering the path or adding a header to version the API... does anyone know? It has the advantage of being clickable while not implying the resource is different.
3 comments

One reason could be constructed by example, as:

  <Location /v3>
vs.

  <LocationMatch ?[.*&]v=3(&|$)>
Which is to say that, depending on the application's coincidental design and structural choices over time, managing versions at /v1 /v2 /v3 might well be vastly easier for the "shoestring budget" operator than at /?v=1 /?v=2 /?v=3.
It seems unlikely considering the other 3 were more drastically different and yet seen as pretty equally easy.
API versioning with query parameters is often an implementer nightmare.
Why..? Does it break through too many abstraction layers?
one benefit of putting version in the path is it makes it easier for loadbalancers to direct traffic. like v3 could be served from different servers than v2
Why can't they do that with the query parameters?
maybe he can, but I know that google cloud's loadbalancer doesn't let you.