Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why have version in headers and not URLs? #47

Open
sujaymansingh opened this issue Sep 5, 2014 · 4 comments
Open

Why have version in headers and not URLs? #47

sujaymansingh opened this issue Sep 5, 2014 · 4 comments

Comments

@sujaymansingh
Copy link

https://github.com/interagent/http-api-design#version-with-accepts-header

What benefits does this have over having the version in the URL? I'm just curious, I'm not a huge advocate of using the version in the URL.

But with the URL, it's easier to see (logs etc) which version is being used.

@dmathieu
Copy link

dmathieu commented Sep 5, 2014

Logging the appropriate version in the logs is also very easy.
Basically, we don't put the version in the URL because it makes further API evolutions quite hard.
Here are a few interesting reads on the subject:

@geemus
Copy link
Member

geemus commented Sep 7, 2014

@sujaymansingh additionally, I would argue that path should just be a reference to an object (and the address shouldn't change between versions, in most cases, even if some behavior and/or representation do change). I like that as a rough guide, similarly keeping headers for meta data (of which I would argue version is one part). Changing/releasing versions is difficult no matter what, but we also have some hope that this will make it slightly easier.

@geemus
Copy link
Member

geemus commented May 13, 2015

Here is a great blog post about why to prefer headers I just came across: https://www.mnot.net/blog/2011/10/25/web_api_versioning_smackdown

@zdne
Copy link

zdne commented May 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants