Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

5 Ways to Build Better Web APIs with Ruby and Rails

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

  • Login to see the comments

5 Ways to Build Better Web APIs with Ruby and Rails

  1. 1. 5 Ways to Build Better Web APIs in Ruby
  2. 2. 1. Select the right API framework and gems
  3. 3. Rails isn't always the right answer
  4. 4. 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
  5. 5. Neither are ORMs… Sequel Datamapper AR 3.2 new(hash) new() Hash Class 0 2 4 6 8
  6. 6. Select a Serializer Select a gem or approach that can build JSON, XML, and (perhaps) any future format as well. (I like Roar + Representable)
  7. 7. Pro Tip: Select your frameworks and gems based on your actual needs (not what someone else says)
  8. 8. 2. Prototype Your API
  9. 9. 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
  10. 10. 3. Acceptance test your APIs
  11. 11. TDD APIs FTW! Acceptance tests will ensure you write better APIs by mimicking how developers will consume your API
  12. 12. 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
  13. 13. 4. Select the right API tools
  14. 14. 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…
  15. 15. 5. Improve the developer experience
  16. 16. Rails trained us to think CRUD
  17. 17. Stop painting your APIs with CRUD to solve problems
  18. 18. Take an outside-in design What is the problem? How does the world view the problem? How does your API solve their problem?
  19. 19. Document your API Build examples for quick wins Speak in their terms
  20. 20. Thank you. @launchany