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!
Let's work together
Tell us about your project and we'll get back to you shortly.
Join The Conversation
More On The Blog
Critical Mistakes To Avoid When Migrating To Shopify
With more than one million businesses currently using Shopify as their preferred eCommerce platform, it’s normal for other online businesses to consider Shopify migrations. Still, re-platforming can be costly (see how much it costs to perform an eCommerce platform migration) and a lot of things can go south if your team is not prepared.
Sol Dieguez — Jun 22, 2022
Is Django better than Ruby on Rails? Django vs Ruby on Rails Comparison
Right now, two of the most popular full-stack web frameworks are Django and Ruby on Rails. These two platforms have similarities, but they’re also quite different when it comes to the details that can make or break a development project.
Sol Dieguez — Jun 15, 2022
How Ruby On Rails SEO improves your eCommerce Google rankings
You might not be familiar with is how Ruby On Rails SEO improves your eCommerce Google rankings. Keep reading to learn the importance of Ruby On Rails SEO and its best practices!
Sol Dieguez — Jun 4, 2022