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
Investing in Digital Marketing in 2021.
In such a competitive environment, the need to increase your online visibility and optimize your site’s conversion rate often demands an investment in digital marketing tactics.
Alejandra Renteria — Jun 16, 2021
3 reasons your website still doesn't work on mobile
More than complying with Google, we believe that setting up your mobile site correctly is key for sites. From ranking higher, to optimizing performance and customer experiences, sites will undoubtedly work better when optimized for mobile from the ground up.
Alejandra Renteria — Jun 3, 2021
Why is it so hard to get an estimate for a software product?
Getting an accurate estimation for your software product can save you time, money and countless headaches when building your site, MVP or product.
David Hemmat — May 20, 2021