Salesforce Developers Blog

Rails 3 and the Force.com REST API made easy with Omniauth and Httparty

Avatar for Quinton WallQuinton Wall
I wanted to share a sample Ruby on Rails 3 app which includes a custom Omniauth strategy for connecting to Force.
Rails 3 and the Force.com REST API made easy with Omniauth and Httparty
March 18, 2011
Listen to this article
0:00 / 0:00

Over the past few months, more and more Ruby developers have asked for some guidelines on how to connect the Force.com platform from a Ruby On Rails 3 applications. The simple answer is to use the REST APIs which went GA in the latest release, Spring 11.  The REST APIs certainly make things easier, but there is still the issue of OAuth, which for many, is a steep learning curve.

If you have been to any presentation I have given, you may have heard me quote something from one of my biggest inspirations, the architect Frank Lloyd Wright. Although Wright was an architect is the traditional sense—he designed buildings, not computer systems—he had an amazingly innate perspective of what good architecture should be.  Frank-lloyd-wright-ronald-bolender

The reason I referring to Wright is that I could have easily put a REST sample out there, but I am a fan of minimalist architecture, and enabling developers to focus on what they need to build not the low level plumbing often associated with traditional software development. To quote Wright, “Simplicity and repose are the qualities that measure the true value of any work of art.

Ruby, language simplicity aside, has two great gems which really embrace that concept of simplicity: Omniauth for handling authentication, and Httparty for working with http reqests. Both of these gems are extremely relevant for what I wanted to write: a simple Rails3 implementation for working with the Force.com REST APIs.

Long story short, I wrote a custom Omniauth strategy to connect to Force.com, used Httparty to handle my REST calls, and put it all on github with a quick how-to guide to get you started.

Enjoy.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS

More Blog Posts

Invoke REST APIs with the Salesforce Integration User and OAuth Client Credentials

Invoke REST APIs with the Salesforce Integration User and OAuth Client Credentials

Learn to configure the Salesforce Integration User for both authentication using OAuth Client Credentials and authorization using permission sets.February 08, 2024

Tableau Innovations for Developers | Learn Moar Summer '23

Tableau Innovations for Developers | Learn Moar Summer '23

Tableau is releasing many innovations in Summer ’23, including the Tableau Embedding Playground, making it easy for you to explore embedded analytics.May 15, 2023