In this blog you will learn the basics of the new Heroku Connect API (currently in beta) and you will see from code examples how you can use the APIs to manage and monitor Heroku Connect.
Intro to Heroku Connect
Heroku is a great place to run customer-facing web and mobile apps that are built with open source technologies like Node.js, Java, and Ruby. Often these apps need to interact with back-office business data and processes. Heroku Connect provides a way to synchronize Salesforce data with a Heroku Postgres database making it available to customer-facing apps on Heroku.
For example, a public product catalog could be run on Heroku using Heroku Postgres to integrate with the product data on Salesforce. That product data could be synchronized to and from Salesforce using Heroku Connect. This also provides the app on Heroku with a standard SQL interface to the Salesforce data. Here is what the architecture looks like:
Often Heroku Connect is managed through the Heroku Dashboard. But the new Heroku Connect API enables other systems to interact with the Heroku Connect service for management and monitoring uses. If you want to dive into Heroku Connect check out the Heroku Connect Quick Start in Trailhead.
Heroku Connect API
The Heroku Platform API enables systems to integrate directly with the management backplane of Heroku through a RESTful interface. This API can be used from anything that can make HTTP calls. The Heroku command line and the Heroku Dashboard are built on top of the Platform API.
Heroku Connect is a Heroku addon so it isn’t directly exposed through the Platform API. However, like the Heroku Platform API, the new Heroku Connect API enables RESTful access to the management backplane of Heroku Connect. Check out the complete Heroku API docs for all the details.
As a simple example, to get information on the configured Heroku Connect connections you can make a HTTP GET request to: https://connect.heroku.com/api/v3/connections?app=<app_name>
Note: The <app_name> is the name of your app on Heroku and you must include a bearer token in the Authorization HTTP Header.
Heroku Connect API Sample App
Check out the following resources for more information:
- Watch a video walk-through of a sample application that uses the Heroku Connect APIs.
- Heroku Connect Quick Start in Trailhead.
- Get the complete source for the sample application on GitHub.
Now you can begin building your own apps that integrate with the Heroku Connect API! Let us know how it goes.
About the Author
James Ward is a Principal Platform Evangelist at Salesforce, helping developers become rock-star Salesforce and Heroku developers.