boom1

Using the Marketo REST API with Boomi Part 1: Getting and Storing a REST Authentication Token

John_M
Marketo Employee
Marketo Employee

Setting up an automatic export of leads that meet a certain criteria is a very common use case with Marketo. Although this can’t currently be done in the Marketo interface, its pretty straightforward to accomplish using the a 3rd party tool like Dell Boomi, a static list with some data management campaigns, and the Marketo REST API.

The REST API? I thought Boomi didn’t have a Marketo REST API Connector! Well, currently, it doesn’t, but its possible to accomplish the same thing using the HTTP Connector and manually defining the jSON response shapes.

The first step is to set up your Marketo instance to use the REST API as outlined in the REST API Marketo Developer page or simply follow the quick-start REST API guide on the Marketo Developer Blog. I’ll also assume you have access to a Dell Boomi account and have the Boomi skills to create these types of integration processes.

The final process will look like the following, and will include calls to the following Marketo REST API operations, each of which has an associated jSON response shape which can be found on the developer site. To save time, I’ve listed them below

Example JSON for Authentication

{ "access_token": "", "token_type": "", "expires_in": 0, "scope": "" }

Example JSON for Get Multiple Leads By List ID

{ "requestId": "", "success": true, "nextPageToken": "", "result": [ { "id": 0, "email": "", "firstName": "", "lastName": "" }, { "id": 0, "email": "", "firstName": "", "lastName": "" }, { "id": 0, "email": "", "firstName": "", "lastName": "" } ] }

Example JSON for Remove Leads from List

{ "requestId": "", "success": true, "result": [ { "id": 1, "status": "" }, { "id": 2, "status": "", "reasons": [ { "code": "", "message": "" } ] } ] }

boom1

Step 1: Define Properties

Before we start calling REST, it’s important to externalize and encapsulate variables you’ll be using. I’ve defined the following shown below.

boomi2

– ClientID: Get this from your REST Launchpoint Service
– Client Secret: Get this from your REST Launchpoint Service
– AccessToken: We’ll get this from a REST call
– Static ListID: The LIST ID of the static list we’ll operate on. Get this from the URL in Marketo
– Fields: A comma separated list of fields the rest service will get from Marketo for each lead. Mine is “id,email,firstName,lastName”
– IDStringToDelete: Will eventually contain the ID of all the leads in the static list to be used in their removal from the list.
– ActivityTypes: Will be used in Part 2 of this blog, where I expand on this!
– SinceDateTime: Will be used in Part 2 of this blog, where I expand on this!
– PagingToken: Will be used in Part 2 of this blog, where I expand on this!
– Folder – Outgoing: The path to the outgoing folder on the SFTP Server. I will use “/data/outgoing” in this example. It allows us to parameterize the SFTP Operation to make it generic.

Step 2: The Authentication Token

As I mentioned, we’ll place a Connector on the canvas after creating the process with a “No Data” start shape (this is just a personal choice, I like all my connectors looking like British plugs).

The Connector should be configured as follows:

– Connector is an HTTP GET Client
– Connection uses URL: https://123-ABC-456.mktorest.com (note no /rest at the end so that we can use this for REST calls as well as using it to get the identity access token.. and change 123-ABC-456 to the right one for your Marketo instance)
– Operation is “Get oAuth Token” (new!)
– Request Profile = None
– Response Profile = JSON
– New Profile called “Authentication Token Response”
– Content Type: Plain
– HTTP Method: GET
– Resource Path (add 4 without quotation marks): “identity/oAuth/token?grant_type=client_credentials&client_id=”; “ClientID (Replacement variable)”; “&client_secret=”; “ClientSecret (Replacement variable)”
– Set Parameters under Configure —> Parameters —>(+): Set ClientID = Process Property Client ID; Set ClientSecret = Process Property Client Secret

After this, store the success token in the Process Properties “AccessToken” variable as shown, extracting it from the jSON response.

boomi3

The pattern for this step will be repeated for the next steps, but using new operations with different jSON return profiles. In fact, many of the REST calls will be dealt with in the same way with minor changes!

In the next installment we’ll expand on this and get a list of leads from a static list using REST!

For now, run the process, but put a stop shape after your “Set Properties” then run in debug to make sure you see the same token that you see in Marketo. They should match up perfectly!

Next up Using the Marketo REST API with Boomi Part 2: Getting Leads from a Static List

1493
0