Marketo Authenticate an Element

You can authenticate with Marketo to create your own instance of the Marketo element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the Marketo platform.

Authenticate Through the UI

Use the UI to authenticate with Marketo and create an element instance. Because you authenticate with Marketo via OAuth 2.0, all you need to do is add a name for the instance and provide your client ID, client secret, identity service URL, and REST service URL you identified in Marketo API Provider Setup. After you create the instance, you'll log in to Marketo to authorize Cloud Elements access to your account. For more information about authenticating an element instance, see Authenticate an Element Instance (UI)

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Use the /instances endpoint to authenticate with Marketo and create an element instance. If you are configuring events, see the Events section.

Note: The endpoint returns an element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To create an element instance:

  1. Construct a JSON body as shown below (see Parameters):

    {
        "element": {
            "key": "marketo"
          },
        "providerData": {
            "code": ""
          },
        "configuration": {
            "oauth.api.key": "<<client_id>>",
            "oauth.api.secret": "<<client_secret>>",
            "marketo.identity.url": "<<marketo_identity_url",
            "base.url": "<<marketo_rest_url>>"
          },
        "tags": [
          "<<TAG_NAME>>",
          "<<TAG_NAME>>"
        ],
          "name": "<<INSERT INSTANCE NAME>>"
    }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Example cURL

curl -X POST  \
 -H 'Authorization: User <INSERT>, Organization <INSERT>'  \
 -H 'Content-Type: application/json'  \
 --data '{ \
  "name": "My Instance", \
  "providerData": { \
    "code": "" \
  }, \
  "configuration": { \
    "filter.response.nulls": "true", \
    "oauth.api.key": "<INSERt>", \
    "oauth.api.secret": "<INSERT", \
    "marketo.identity.url": "<INSERT>", \
    "base.url": "<INSERT>" \
  } \
}'

Parameters

API parameters not shown in Cloud Elements are in code formatting.

Note: Event related parameters are described in Events.
ParameterDescriptionData Type
'key'The element key.
marketo
string
Name
name
The name for the element instance created during authentication.string
marketo.identity.urlThe Identity URL from Marketo. This is the Identity URL that you noted at the end of API Provider Setup.
oauth.api.keyThe API Key from Marketo. This is the API Key that you noted at the end of API Provider Setup.string
oauth.api.secretThe Consumer Secret from Marketo. This is the Consumer Secret that you noted at the end of API Provider Setup.string
base.urlThe Marketo REST URL. This is the REST URL that you noted at the end of API Provider Setup.string
Filter null values from the response
filter.response.nulls
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values.
Default: true.
boolean
tagsOptional. User-defined tags to further identify the instance.string

Example Response

{
  "id": 427164,
  "name": "My Instance",
  "createdDate": "2017-06-06T18:00:26Z",
  "token": "<<token value>>",
  "element": {
    "id": 85,
    "name": "Marketo",
    "hookName": "Marketo",
    "key": "marketo",
    "description": "Add a Marketo Instance to connect your existing Marketo account to the Marketing Hub, allowing you to manage accounts, campaigns, contacts, leads etc. across multiple Marketing elements. You will need your Marketo account information to add an instance.",
    "image": "elements/provider_marketo.png",
    "active": true,
    "deleted": false,
    "typeOauth": true,
    "trialAccount": false,
    "configDescription": "If you do not have an Marketo account, you can create one at <a href=\"//http://pages2.marketo.com/freetrial.html\"\n        target=\"_blank\">Marketo Signup</a>",
    "resources":[],
    "transformationsEnabled": true,
    "bulkDownloadEnabled": true,
    "bulkUploadEnabled": true,
    "cloneable": true,
    "extendable": true,
    "beta": false,
    "authentication": {
      "type": "oauth2"
    },
    "extended": false,
    "hub": "marketing",
    "protocolType": "http",
    "parameters": [],
    "private": false
  },
  "elementId": 85,
  "provisionInteractions": [],
  "valid": true,
  "disabled": false,
  "maxCacheSize": 0,
  "cacheTimeToLive": 0,
  "configuration": {
    "event.notification.subscription.id": null,
    "oauth.api.secret": "qePHp0mBzTE693mJg20ls2CNhSi0Bbmm",
    "base.url": "https://338-ZRW-745.mktorest.com/rest",
    "marketo.identity.url": "https://338-ZRW-745.mktorest.com/identity",
    "event.vendor.type": "polling",
    "event.helper.key": "marketoPolling",
    "oauth.user.token": "25607056-f75d-42b5-a58a-cef2f016ad36:ab",
    "filter.response.nulls": "true",
    "event.poller.refresh_interval": "15",
    "event.notification.callback.url": null,
    "event.notification.signature.key": null,
    "event.poller.urls": "leads",
    "oauth.user.refresh_interval": "3381",
    "oauth.api.key": "451a529b-8f0f-404a-93b7-b5adb7a01ef1",
    "oauth.user.refresh_time": "1496772027604"
  },
  "eventsEnabled": false,
  "traceLoggingEnabled": false,
  "cachingEnabled": false,
  "externalAuthentication": "none",
  "user": {
    "id": 123456
  }
}