Skip to content

Instantly share code, notes, and snippets.

@alieseparker
Created November 11, 2014 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alieseparker/f523c2506ae97da2c020 to your computer and use it in GitHub Desktop.
Save alieseparker/f523c2506ae97da2c020 to your computer and use it in GitHub Desktop.
Rails API Research
# Api Versionioning
Ok, so we want to version our app. But which one is the best? This led me down the rabbit hole and into the depths of the darkest parts of the internet.
Here: http://stackoverflow.com/questions/389169/best-practices-for-api-versioning
the admins of stackoverflow closed this very question since as they put it
```
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.
```
Once I saw this I was better able to grasp the idea of versioning your API. I found this blog post by Troy Hunt who describes the three wrong ways to version your API and points out that you must merely choose the one that makes the most since to you and fits your app the best. So, going from here lets talk a bit about API Versioning.
As far as I can tell there are three main ways you can version your API
- 1. URL Versioning - you can include the version in your URL which is most simple
- 2. Custom Request Headers - You use the same URL as before, except you modify the header to include the version
- 3. Content Type - You modify the accept header to specify the version which sounds like it would be really hard to test.
So, which will I choose for my GemStore API?
I'm going to try the URL Versioning first, but would like to try and eventually implement all three.
## Contributions
http://www.troyhunt.com/2014/02/your-api-versioning-is-wrong-which-is.html
http://blog.brianploetz.com/post/18768947761/versioning-rails-3-based-restful-apis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment