a RoR 2.3 app • Online since end of 2008 • Primary purpose was serving the iOS app • Strictly REST-‐ful, small feature set GET http://api.qype.com/v1/places/1
are not forgiven! – Client lock-‐in • Clients can differ vastly – Mobile app vs. Web mash-‐up • Authen3ca3on and access control – An API is meant to access your core data by design • Performance maDers (even more)
• Architecture/deployment – One app per version? • E.g. qype-‐api-‐v2 – One engine per version? • E.g. app/engines/v2 – One class per version? • E.g. app/controllers/resource_controller_v2.rb
does a test apply? • Code sharing vs. code duplica3on? – i.e. not all routes may change with an increment • Also affects caching etc. • Gems: – hDps://github.com/bploetz/versionist – hDps://github.com/filtersquad/rocket_pants
not simple • Hence, a simple API is not always suitable • REST paradigm can be sokened on an AAL – Batch requests – { “requests”: [ { “method”: “get”, “uri”: “hDp://...” } ... ] }
• Goal: – Map AR models to intermediate format, then serialize – Review.first.to_api(:hash) • Gems: – hDps://github.com/rails/jbuilder/ – hDps://github.com/nesquena/rabl