Marketo Library Implementation Document

Written By Devin O'Neill ()

Updated at April 16th, 2025

Set up

Connections

  • On the Marketo dashboard, select Navigation.
  • Click on Connections.
  • User can select multiple connections where the customer can connect to Marketo products and data using APIs and other services.
  • User will be able to indicate which connections are Required or Optional.

End points

  • The URL endpoints will enable the user to authenticate and test the applications during installation process.

Marketo Library Functions

Below are the Marketo library functions in which the Marketo APIs are called.

Staging file path: http://api.socialannexstaging.com/marketo/Marketo.php
Production file path: https://api.socialannex.com/marketo/Marketo.php

Payload:

$marketoObject = new Marketo();
$marketoObject->client_id = ‘89455fc7-7e6e-4dc3-9a65-ca2554b86031’;
$marketoObject->client_secret = ‘21CyunLMYUiM47YCubgQKGZ06G68rzTJ’;

$marketoObject->client_identity_url = "https://130-ldw-
186.mktorest.com/identity";

$marketoObject->client_endpoint_url = "https://130-ldw-
186.mktorest.com/rest";

Functions:

Function to generate token

This function will return to generate token and access token to use in further functions.

Payload:

$accessToken = $marketoObject->generateToken();
if(!is_array($accessToken))
{
$listId = ‘1007;
$email = ‘sa.matthenry@gmail.com’;
$dataArray = array(‘firstname’ => ‘Matt’, ‘lastname’ => ‘Henry’,
‘available_points’ => 1000);

Function to add Or update contact

This function is used to add contact or update contact into Marketo ESP database.

Parameters:

Parameter Name Parameter Description Example
$accessToken

Create using generateToken

function.

 
$listId (required) Id of contact list. 1007
$email (required) Enter the email address of the user. sa.matthenry@gmail.com
 
$fieldData (required) Enter the field mapping array. Array
(
[userName] => Madhuri
Natu
[address] => JM Road,
Pune
[question] => Test1
[qusDbAddDate] =>
4/15/2019
)

Payload:

$marketoObject->addOrUpdateContact($accessToken, $listId, $email,
$dataArray);
}
else
{
//Do Error handling

}