Force.com and Heroku are both part of the Salesforce1 platform. There are lots of great ways to leverage force.com from your Heroku app. This article will give an overview and pointers to get you started.
The easiest way to link force.com and Heroku is to use our two-way data synchronization service Heroku Connect. This point-and-click service lets you synchronize data from force.com into the Postgres database attached to your Heroku app. You can read and write data directly in Postgres, and changes are automatically synchronized with force.com.
Note that Heroku Connect moves data asynchronously. This means that when your app writes data to Postgres, control flow returns as soon as the data is written to the database. The data won’t be copied to force.com until later (various factors affect latency). The asynchronous operation has some advantages, but isn’t a fit for situations where you need the answer from force.com immediately.
There are great client libraries for accessing force.com available for almost any language. These libraries give you synchronous accesss to many of the APIs provided by force.com. All of these libraries are open source, and you are encouraged to submit issues, patches, or improvements.
Force.com offers a number of different APIs. Here is a quick rundown on those APIs to help you find the client library that acccess the API you want:
|SOAP||CRUD API using SOAP protocol, support for batch operations|
|REST||CRUD API using REST (JSON or XML over HTTP)|
|Streaming||Event notification API using CometD protcol|
|Bulk||Asynchronous API for reading or writing large amounts of data|
|Metadata||API for making schema modifications|
The force.com Web Service Connector is the standard client library published by Salesforce for accessing force.com. You can use the WSC to interact with the force.com SOAP API or Bulk API.
You can access the force.com Streaming API using the standard CometD implementation:
Access the force.com REST API and Streaming API with the restforce gem (https://github.com/ejholmes/restforce):
gem install restforce
You can access the Bulk API with the salesforce_bulk gem (https://github.com/jorgevaldivia/salesforce_bulk):
gem install salesforce_bulk
Node.js is supported by the awesome nforce package from Kevin O’Hara (https://github.com/kevinohara80/nforce):
npm install nforce
Nforce supports the REST API and the Streaming API.
Access the SOAP API using the Force.com Toolkit for PHP available here:
Access the REST API using the simple-salesforce package (https://github.com/neworganizing/simple-salesforce):
pip install simple_salesforce
An older library for acessing the SOAP API is the salesforce-python-toolkit:
You can access the Bulk API with the salesforce-bulk package (https://github.com/heroku/salesforce-bulk):
pip install salesforce-bulk
Salesforce publishes the Salesforce Mobile SDK for iOS here:
Salesforce publishes the Salesforce Mobile SDK for Android here:
The force.com Command Line Interface is a utility written in GO for accessing the SOAP API and Metadata API. It can be very useful for scripting operations to force.com: