For this week's learning lunch we took a look at the RubyConf AU 2013 Lightning Talks and Active Model Serializers (RailsCasts). The two presentations tied together nicely as one of the lightning talks was on APIs and the RailsCast was on a way to craft them.
An API (Application Programming Interface) is a set of commands, functions, and protocols which programmers can use when building software for a specific system. Crafting your API correctly is the ticket to happiness, success, and general Good Times. Rails is exceptionally good at exposing an API and there are some great gems available to help in this process.
For the recent Gap Filler app we created and documented an API so that anyone could write their own program to use the data. This means anyone interested could easily create, say, an Android app using the same interface our iPhone app does. For Gap Filler we used the RABL gem which uses a view based approach rather than the more object oriented approach of Active Model Serializers. There are strengths and weaknesses to both approaches, but, as always, it's great to have the choice.
Finally, the last thing to think about and one which was highlighted in the lightning talk, is versioning your API. The reason for this is that once you have an API people tend to use them. If you go changing things then you will likely break all the systems which are depending on your API. For Gap Filler itself we did not include versioning from the start, however, were we to extend the API we would certainly add versioning. For a larger project and one which was likely to have an evolving API we would certainly include versioning from the start and yes, there's the versionist gem for that!
Join The Conversation
More On The Blog
Preparing your site for the best Q4 ever
In this article we’ll look at key steps to take for planning this holiday season, the importance of optimizing your site for a unique customer experience and conversion rate, in preparation for your best Q in 2020.
Alejandra Renteria — Sep 17, 2020
Responsive Web Design: A must have for eCommerce in 2020
In this article we’re taking a closer look at this must-have piece of infrastructure for your site and simple reasons to not put off implementing it for your site.
Alejandra Renteria — Sep 16, 2020
3 digital payments that optimize your customer experience
In this article we take a look at the 3 preferred methods of payment for customers in the United States, providing you with highlights of their set up and how they help you optimize your customer experience.
Alejandra Renteria — Sep 10, 2020