|||

Video Transcript

X

Using force.com from your Heroku apps

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.

Heroku Connect

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.

Force.com client libraries

There are great client libraries for accessing force.com available for almost any language. These libraries give you synchronous access 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 access the API you want:

API Description
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 protocol
Bulk Asynchronous API for reading or writing large amounts of data
Metadata API for making schema modifications

Java

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.

Ruby

Access the force.com REST API and Streaming API with the restforce gem:

gem install restforce

You can access the Bulk API with the salesforce_bulk gem:

gem install salesforce_bulk

Node.js

Node.js is supported by the awesome nforce package from Kevin O'Hara:

npm install nforce

Nforce supports the REST API and the Streaming API.

PHP

Access the SOAP API using the Force.com Toolkit for PHP.

Python

Access the REST API using the simple-salesforce package:

pip install simple_salesforce

An older library for accessing the SOAP API is the salesforce-python-toolkit.

You can access the Bulk API with the salesforce-bulk package:

pip install salesforce-bulk

Objective-C (iOS)

Salesforce publishes the Salesforce Mobile SDK for iOS here:

https://github.com/forcedotcom/SalesforceMobileSDK-iOS

Java - Android

Salesforce publishes the Salesforce Mobile SDK for Android here:

https://github.com/forcedotcom/SalesforceMobileSDK-Android

Command line

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:

https://github.com/ForceCLI/force

Originally published: July 08, 2014

Browse the archives for engineering or all blogs Subscribe to the RSS feed for engineering or all blogs.