This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Leads in Marketo
Overview
The following operations allow you to work with leads. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with leads, see Sample configuration.
Operation | Description |
---|---|
getLeadById | Retrieves a lead for a given Marketo Id. |
getMultipleLeadsByFilterType | Retrieves multiple leads for given search criteria. |
getMultipleLeadsByListId | Retrieves multiple leads from a list with the given list id. |
createAndUpdateLeads | Creates a new lead or Updates an existing lead. |
associateLead | Associates a lead with a cookie value. |
mergeLead | Merges two leads(Losing lead with winning lead). |
getLeadPartitions | Retrieves a list of lead partitions in a Marketo instance. |
getMultipleLeadsByProgramId | Retrieves multiple leads from a given program id. |
deleteLead | Deletes leads with the given ids. |
describe | Retrieves all fields and the data type of a lead object. |
importLead | Imports leads in bulk. |
getImportLeadStatus | Retrieves the status of lead operation from ImportLead call. |
getImportFailureFile | Retrieves of the failure file from a ImportLead Call. |
getImportWarningFile | Retrieves of the warning file from a ImportLead Call. |
Operation Details
This section provides further details on the operations related to leads.
Get Lead by Id
The getLeadById
operation retrieves a lead for a given Marketo Id.
<marketo.getLeadById> <leadId>{$ctx:leadId}</leadId> <fields>{$ctx:fields}</fields> </marketo.getLeadById>
properties
leadId
: The Marketo Id of the lead.fields
: List of fields to be returned in response.
Sample request
Following is a sample REST/JSON request that can be handled by the getLeadById
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "leadId":"11", "fields":"lastName,email" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-lead-by-id/
Get Multiple Leads By Filter Type
The getMultipleLeadsByFilterType
 operation retrieves multiple leads for given search criteria.
<marketo.getMultipleLeadsByFilterType> <filterType>{$ctx:filterType}</filterType> <filterValues>{$ctx:filterValues}</filterValues> <fields>{$ctx:fields}</fields> <batchSize>{$ctx:batchSize}</batchSize> <nextPageToken>{$ctx:nextPageToken}</nextPageToken> </marketo.getMultipleLeadsByFilterType>
properties
filterType
: Filter type to retrieve the leads.filterValues
: Comma separated list of filter values.fields
: Comma separated list of fields to be returned in response.batchSize
: The number of lead records to be returned in a single call.nextPageToken
: Used to paginate through large result sets.
Sample Request
Following is a sample REST/JSON request that can be handled by the getMultipleLeadsByFilterTypeÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "filterType":"id", "filterValues":"387,390,393,398,399", "fields":"lastName,firstName", "batchSize":"3" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-multiple-leads-by-filter-type/
Get Multiple Leads by List Id
The getMultipleLeadsByListId
operation retrieves multiple leads from a given list id.
<marketo.getMultipleLeadsByListId> <listId>{$ctx:listId}</listId> <fields>{$ctx:fields}</fields> <batchSize>{$ctx:batchSize}</batchSize> <nextPageToken>{$ctx:nextPageToken}</nextPageToken> </marketo.getMultipleLeadsByListId>
properties
listId
: ID of the list.fields
: List of fields to be returned in response.batchSize
: The number of lead records to be returned in a single call.nextPageToken
: Used to paginate through large result sets.
Sample Request
Following is a sample REST/JSON request that can be handled by the  getMultipleLeadsByListId
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "listId":"3", "fields":"lastName", "batchSize":"1", "nextPageToken": "PS5VL5WD4UOWGOUCJR6VY7JQOZTXMC7UO74OEIV2HN4NCJZW32AA====" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-multiple-leads-by-list-id/
Create and Update Leads
The createAndUpdateLeads
 creates a new lead or updates an existing lead.Â
<marketo.createAndUpdateLeads> <input>{$ctx:input}</input> <action>{$ctx:action}</action> <lookupField>{$ctx:lookupField}</lookupField> <asyncProcessing>{$ctx:asyncProcessing}</asyncProcessing> <partitionName>{$ctx:partitionName}</partitionName> </marketo.createAndUpdateLeads>
properties
input
: Array of lead records to create or update.action
: The action need to be taken with this call.Possible values(createOnly,updateOnly,createOrUpdate(default request),createDuplicate)lookupField
: Attribute to find the duplicate.asyncProcessing
: Used to specify post processing when calling the creating/updating leads.partitionName
: Lead partition name.
Sample requestÂ
Following is a sample REST/JSON request that can be handled by the createAndUpdateLeads
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "action":"updateOnly", "lookupField":"email", "partitionName":"default", "asyncProcessing":"true", "input":[ { "email":"con-5@gmail.com", "firstName":"con-1", "postalCode":"04828" }, { "email":"con-4@gmail.com", "firstName":"con-2", "postalCode":"04828" }, { "email":"con-3@gmail.com", "firstName":"con-3", "postalCode":"04828" } ] }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/createupdate-leads/
Associate Lead
The associateLead
operation associates a lead with a cookie value.
<marketo.associateLead> <leadId>{$ctx:leadId}</leadId> <cookie>{$ctx:cookie}</cookie> </marketo.associateLead>
properties
leadId: The Marketo Id of the lead.
cookie: Cookie value of lead.
Sample request
Following is a sample REST/JSON request that can be handled by the associateLeadÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "leadId":"392", "cookie":"id:287-GTJ-838%26token:_mch-marketo.com-1396310362214-46169" }
Related Marketo documentation
Merge Lead
The mergeLead
operation merges two leads(merges losing lead with winning lead).
<marketo.mergeLead> <wLeadId>{$ctx:wLeadId}</wLeadId> <lLeadId>{$ctx:lLeadId}</lLeadId> <mergeInCRM>{$ctx:mergeInCRM}</mergeInCRM> </marketo.mergeLead>
properties
wLeadId: The Marketo Id of the winning lead.
lLeadId: The Marketo Id of the lead(losing) to be merged.
mergeInCRM: Set to true to merge in CRM.
Sample request
Following is a sample REST/JSON request that can be handled by the mergeLeadÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "wLeadId":"388", "lLeadId":"387" }
Related Marketo documentation
Get Lead Partitions
The getLeadPartitions
operation retrieves a list of lead partitions in a Marketo instance.
<marketo.getLeadPartitions/>
Sample request
Following is a sample REST/JSON request that can be handled by the getLeadPartitionsÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1" }
Related Marketo documentation
getMultipleLeadsByProgramId
The getMultipleLeadsByProgramId
operation retrieves multiple leads from a given program id.
<marketo.getMultipleLeadsByProgramId> <programId>{$ctx:programId}</programId> <fields>{$ctx:fields}</fields> <batchSize>{$ctx:batchSize}</batchSize> <nextPageToken>{$ctx:nextPageToken}</nextPageToken> </marketo.getMultipleLeadsByProgramId>
properties
programId: The Marketo Id of the program.
fields: List of fields to be returned in response.
batchSize
: The number of lead records to be returned in a single call.nextPageToken
: Used to paginate through large result sets.
Sample request
Following is a sample REST/JSON request that can be handled by the getMultipleLeadsByProgramIdÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "programId":"1003", "fields":"lastName,email", "batchSize":"5", "nextPageToken": "PS5VL5WD4UOWGOUCJR6VY7JQOZTXMC7UO74OEIV2HN4NCJZW32AA====" }
Related Marketo documentation
Delete Lead
The deleteLead
operation deletes leads with the given ids.
<marketo.deleteLead> <leadIds>{$ctx:leadIds}</leadIds> </marketo.deleteLead>
properties
leadIds: Comma separated list of leads ids.
Sample request
Following is a sample REST/JSON request that can be handled by the deleteLeadÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "leadIds":"390,392,398" }
Related Marketo documentation
Describe
The describe
operation retrieves all fields and the data type of a lead object.
<marketo.describe/>
Sample request
Following is a sample REST/JSON request that can be handled by the describeÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1" }
Related Marketo documentation
Import Lead
The importLead
operation imports leads in bulk.
<marketo.import> <marketoInstanceURL>{$url:marketoInstanceURL}</marketoInstanceURL> <accessToken>{$url:accessToken}</accessToken> <format>{$url:format}</format> <lookupField>{$url:lookupField}</lookupField> <listId>{$url:listId}</listId> <partitionName>{$url:partitionName}</partitionName> </marketo.import>
properties
marketoInstanceURL
: Your marketo instance URL.accessToken
: Valid access_token.format
: Format of the file to be imported.listId
: Marketo Id of the list.lookupField
: Attribute to find the duplicate.partitionName
: Lead partition name.
Sample request
Following is a sample REST/JSON request that can be handled by the importLead
 operation.
curl -i -F format=csv -F file=@leads.csv -F access_token=919340b7-2e08-427d-a3cc-67e34b5647bd:sj https://Abc-def-029.mktorest.com/bulk/v1/leads.json
Related Marketo documentation
http://developers.marketo.com/documentation/rest/import-lead/
Get Import Lead Status
The getImportLeadStatus operation retrieves the status of lead operation from ImportLead API call.
<marketo.getImportLeadStatus> <batchId>{$ctx:batchId}</batchId> </marketo.getImportLeadStatus>
properties
batchId: Batch id returned from importLead call.
Sample request
Following is a sample REST/JSON request that can be handled by the getImportLeadStatus operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "batchId":"7" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-import-lead-status/
Get Import Failure File
The getImportFailureFile
operation retrieves of the failure file from a ImportLead Call.
<marketo.getImportFailureFile> <batchId>{$ctx:batchId}</batchId> </marketo.getImportFailureFile>
properties
batchId
: Batch id returned from importLead call.
Sample request
Following is a sample REST/JSON request that can be handled by the getImportFailureFile
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "batchId":"30" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-import-failure-file/
Get Import Warning File
The getImportWarningFile
operation retrieves of the failure file from a ImportLead Call.
<marketo.getImportWarningFile> <batchId>{$ctx:batchId}</batchId> </marketo.getImportWarningFile>
properties
batchId
: Batch id returned from importLead call.
Sample request
Following is a sample REST/JSON request that can be handled by the getImportWarningFile
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "batchId":"30" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-import-warning-file/
Sample Configuration
Following is a sample proxy service that illustrates how to connect to Marketo with the init operation and use the
getLeadById
 operation. The sample request for this proxy can be found in  getLeadById sample request. You can use this sample as a template for using other operations in this category.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="getLeadById" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="marketoInstanceURL" expression="json-eval($.marketoInstanceURL)"/> <property name="clientId" expression="json-eval($.clientId)"/> <property name="clientSecret" expression="json-eval($.clientSecret)"/> <property name="leadId" expression="json-eval($.leadId)"/> <property name="fields" expression="json-eval($.fields)"/> <marketo.init> <marketoInstanceURL>{$ctx:marketoInstanceURL}</marketoInstanceURL> <clientId>{$ctx:clientId}</clientId> <clientSecret>{$ctx:clientSecret}</clientSecret> </marketo.init> <marketo.getLeadById> <leadId>{$ctx:leadId}</leadId> <fields>{$ctx:fields}</fields> </marketo.getLeadById> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <description/> </proxy>