[katello-devel] API versioning

Ohad Levy ohadlevy at redhat.com
Thu Jun 7 10:44:11 UTC 2012


On 06/04/2012 12:12 PM, Ivan Nečas wrote:
> Hello,
>
> There has been a discussion about API versioning in foreman-dev [1]
> recently. Since we are ahead of API changes (both adding features and
> refactoring old calls), I would like to open this discussion for Katello
> as well. There are two links mentioned talking about using namespaces
> for that purpose [2] [3] (Github works this way as well, Twitter goes
> the similar way as well).
>
> So basically there would be 'katello/api/v1/…' for the old version and
> 'katello/api/v2/…' for the new one. This would help us with the
> migration phase where some users might still rely on the old API for
> some time and give them time to migrate to new version of the API. When
> the V2 API is stable, the old one would get depreciated and eventually
> removed.
>
> What do you thing about this approach?
>
> [1] -
> https://groups.google.com/group/foreman-dev/browse_thread/thread/dc7a099ab75360f4
>
> [2] - http://freelancing-gods.com/posts/versioning_your_ap_is
> [3] - http://railscasts.com/episodes/350-rest-api-versioning?autoplay=true
>


I've implemented a very basic implementation that supports
1. API versioning via an http header e.g. Accept:'Application/json 
version=1'
2. the ablity to define the default api version, so in any case you dont 
see a version in the url.
3. added rabl for easy representation / tweaking of api output (not to 
relay on as_json method etc)

https://github.com/ohadlevy/foreman/commit/abcda01b697aca83d40e25387abc052b7e518949


Ohad




More information about the katello-devel mailing list