Restforce

Restforce is the most popular Ruby gem for interacting with Salesforce using the Salesforce API, downloaded over 4,000,000 times.

Get started

1. Add restforce to your Gemfile, then run bundle install (or install it manually with gem install).

gem 'restforce', '~> 2.4.0'

2. Instantiate a Restforce client object with your API authentication details. You can use your username and password as below, or authenticate with OAuth.

# Don't commit your authentication details with your code - use environment variables <3
export SALESFORCE_USERNAME="username"
export SALESFORCE_PASSWORD="password"
export SALESFORCE_SECURITY_TOKEN="security token"
export SALESFORCE_CLIENT_ID="client id"
export SALESFORCE_CLIENT_SECRET="client secret"
client = Restforce.new

3. Query Salesforce like an absolute pro.

my_leads = client.query("SELECT Id, Source FROM Lead where OwnerId = 'INSERT_USER_ID_HERE'")
# => #<Restforce::Collection >

Learn more

To discover all the great things you can do with Restforce, check out the README and the full documentation.

Stay up to date

Get involved

We welcome contributions and bug reports so we can together make Restforce as great as possible 💕

We'd love to have you involved, whether it's your first open source contribution or your thousandth. To get started, see our CONTRIBUTING.md, and take note of our code of conduct.

If you have any questions, contact Tim Rogers, the maintainer.

Get in touch

Want help using Restforce, with contributing, or have another question?

Get in touch with Tim Rogers, the maintainer of Restforce, at [email protected].

Restforce is released under the MIT license
Page last updated 20th September 2016
© Tim Rogers and Eric J. Holmes 2016