Navigation Menu

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

Versioning API endpoints #710

Closed
speier opened this issue Mar 24, 2013 · 7 comments
Closed

Versioning API endpoints #710

speier opened this issue Mar 24, 2013 · 7 comments
Labels
feature New functionality or improvement

Comments

@speier
Copy link

speier commented Mar 24, 2013

Is there any advice on how to implement versioning?

For example:

api.example.com/v1/magazines.json
api.example.com/v2/magazines.json
@geek
Copy link
Member

geek commented Mar 24, 2013

That is one option, another is to use an accept header like how github does their versioning. See http://developer.github.com/v3/media/

Where the Accept header is in the form:
application/vnd.github[.version].param[+json]

If you want the version to be part of the path then you can include it within the route path property.

server.route({ path: { '/v1/magazines' }

@hueniverse
Copy link
Contributor

hapi doesn't have an opinion on versions atm. We're looking into supporting Accept header for content negotiation which is cleaner than using /v1 in the path. In general, my personal view is that there should be one API. You use the same paths as long as they are backwards compatible, you use Accept header to change the response payload and content-type to change the request payload. And mint new paths for non-compatible changes. I would never do /v1 /v2 but that's just me.

Either way, we will look into supporting these patterns in hapi soon. but probably post 1.0.

@speier
Copy link
Author

speier commented Mar 24, 2013

Thanks for your thoughts. The Accept header idea sounds good.
Also supporting these patterns in hapi would be great. Keep up the good work guys.

@speier speier closed this as completed Mar 24, 2013
@hueniverse hueniverse reopened this Mar 25, 2013
@hueniverse
Copy link
Contributor

Moved to backlog.

@hueniverse
Copy link
Contributor

The best source of alternatives: http://www.mnot.net/blog/2011/10/25/web_api_versioning_smackdown

@hueniverse
Copy link
Contributor

Duplicate of #252

@Marsup Marsup added feature New functionality or improvement and removed request labels Sep 20, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

4 participants