5 Ways to Build Better Web APIs with Ruby and Rails

71 %
29 %
Information about 5 Ways to Build Better Web APIs with Ruby and Rails

Published on February 25, 2014

Author: launchany

Source: slideshare.net


5 ways to improve your Ruby and Rails web APIs:

1. Select the right framework and rubgems
2. Prototype your API first
3. Build acceptance tests
4. Utilize API tools for faster development
5. Build a great developer experience

5 Ways to Build Better Web APIs in Ruby

1. Select the right API framework and gems

Rails isn't always the right answer

Not all frameworks are == Ramaze Scorched Rails Sinatra NYNY Nancy Rambutan Brooklyn Rack::Response Hobbit Cuba Rack 0 2000 4000 6000 8000 Requests/sec (Higher is better) 10000

Neither are ORMs… Sequel Datamapper AR 3.2 new(hash) new() Hash Class 0 2 4 6 8

Select a Serializer Select a gem or approach that can build JSON, XML, and (perhaps) any future format as well. (I like Roar + Representable)

Pro Tip: Select your frameworks and gems based on your actual needs (not what someone else says)

2. Prototype Your API

Ways to Prototype Static files – manual response for GET only Stubbed controllers – works for all request types Heroku Dataclips – great for a quick way to build SQL-to-JSON for GET requests

3. Acceptance test your APIs

TDD APIs FTW! Acceptance tests will ensure you write better APIs by mimicking how developers will consume your API

What should you use? RSpec, Cucumber, ??? One is not better than another Use a testing framework so a failure should break your build and report on what failed

4. Select the right API tools

Examples of API Tools Exploration: POSTman Chrome Plugin Documentation: RAML, Runscope, APIDesigner Debugging: RunScope, SOAPUI Auth/token and portal mgmt: Layer 7, Apigee, Mashery, 3Scale, Stormpath and many others…

5. Improve the developer experience

Rails trained us to think CRUD

Stop painting your APIs with CRUD to solve problems

Take an outside-in design What is the problem? How does the world view the problem? How does your API solve their problem?

Document your API Build examples for quick wins Speak in their terms

Thank you. james@launchany.com @launchany http://bit.ly/better-ruby-apis

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

Imagine what you could build if you learned Ruby on Rails…

Imagine what you could build if you learned Ruby on Rails ... modern web application is daunting. Ruby on Rails makes it ... Rails 5.0.0.beta3 ...
Read more

Rails Framework Documentation - Ruby on Rails API

Ruby on Rails ... Change directory to myappand start the web server: cd myapp; rails server ... Ruby on Rails Guides. The API Documentation.
Read more

GitHub - rails-api/rails-api: Rails for API only applications

README.md Rails::API. IMPORTANT: Rails::API has been merged into Rails. Rails::API is a subset of a normal Rails application, created for applications that ...
Read more

List of 40 tutorials on how to create an API - Mashape Blog

List of 40 tutorials on how to create an API ... http://railsware.com/blog/2013/04/08/api-with-ruby-on-rails ... http://www.asp.net/web-api/overview ...
Read more

GoRails - Ruby on Rails screencasts for Web Developers ...

Videos to help you learn any aspect of web development. Short screencasts for Ruby on Rails developers. ... How to Deploy ActionCable and Rails 5 To ...
Read more

Rails Routing from the Outside In — Ruby on Rails Guides

Rails Routing from the Outside In. ... you may want to customize them in some way. Rails allows you to customize virtually any ... "Rails", "Ruby on ...
Read more

Getting Started with Rails — Ruby on Rails Guides

Getting Started with Rails. ... a look at ruby-lang.org for possible ways to install Ruby on your ... doc/api/index.html in your web browser to explore ...
Read more

Ruby | Codecademy

Codecademy is the easiest way to learn ... can use on its own or as part of the Ruby on Rails web ... over both to help you build better ...
Read more

GitHub - rails/rails: Ruby on Rails

Prep release for Rails 5 beta3: Feb ... Change directory to myapp and start the web server: $ cd myapp $ rails server ... The API Documentation; Ruby on ...
Read more