Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RABLing, Serializing and JBuilding better APIs

michdsouza
October 22, 2013

RABLing, Serializing and JBuilding better APIs

When building JSON APIs for mobile apps, we find ourselves wanting a more expressive and powerful solution. This is especially true when the JSON representation is complex or doesn't match the exact schema defined within the database. In this presentation, we demo not One, not Two but Three different ways of generating APIs in rails: RABL, Active Model Serializers and JBuilder, and highlight what we've learnt from each one of them.

michdsouza

October 22, 2013
Tweet

Other Decks in Programming

Transcript

  1. JSON APIS THINGS TO CONSIDER ‣ Should responses include a

    root? ‣ Which attributes to include? ‣ Which associations to embed? ‣ Should responses include data not representative of the model? ‣ How can I avoid duplication? Thursday, October 24, 13
  2. Why RABL? ‣ Treats APIs like views ‣ Fast creation.

    Why not RABL? ‣ Confusing DSL ‣ Going custom can become challenging Thursday, October 24, 13
  3. ‣ Do not have to “craft” each API ‣ Easy

    to define schemas ‣ Very Ruby-like syntax ‣ RSpec Testing ‣ No view layer Why ActiveModel Serializers? Thursday, October 24, 13
  4. Why JBuilder? ‣ Built into Rails 4 ‣ Easier syntax

    ‣ Better performance than RABL Thursday, October 24, 13