getLeadActivity

This function retrieves the activity history for a single lead identified by the provided key. You can specify which activity types you wish to be returned in the result. If you want all activity types, a blank value needs to be passed. For more than one activity type, pass in a list of activity types. When requesting multiple activities, the remaining count is not an accurate number, but should be treated as a flag which indicates that there are more activities when the remaining count > 0.

A stream position can be used to paginate through large result sets.

The complete list of activity types can be found within the ActivityType enumeration located in the SOAP API WSDL.

Request

Field Name

Required/Optional

Description

leadKey->keyType Required keyType allows you to specify the field you wish to query the lead by. Possible values include:

IDNUM: The Marketo ID (e.g. 64)

COOKIE: The value generated by the Munchkin Javascript. (e.g. id:561-HYG-937&token:_mch-marketo.com-1258067434006-50277)

EMAIL: The email address associated with the lead. (e.g. rufus@marketo.com)

SFDCLEADID: The lead ID from SalesForce

LEADOWNEREMAIL: The Lead Owner Email

SFDCACCOUNTID: The Account ID from SalesForce

SFDCCONTACTID: The Contact ID from SalesForce

SFDCLEADID: TheLead ID from SalesForce

SFDCLEADOWNERID: The Lead owner ID from SalesForce

SFDCOPPTYID: The Opportunity ID from SalesForce

leadKey->keyValue Required keyValue is the value you wish to query the lead by.
activityFilter->includeAttributes->activityType Optional Limits the response to include only those activity types specified. See WSDL for all activity types.
activityFilter->excludeAttributes->activityType Optional Limits the response to exclude those activity types specified. See WSDL for all activity types. NOTE: You cannot specify both includeAttributes and excludeAttributes within the same call.
batchSize Optional Maximum number of records to be returned. System will limit to 100 or batchSize, whichever is less.
startPosition->offset Optional Used to paginate through large number of activity responses. The offset value is returned by the previous calls response field newStartPosition->offset.
startPosition->activityCreatedAt Optional

Used to paginate through large number of activity responses. The activityCreatedAt is returned by the previous call’s response field newStartPosition->activityCreatedAt. (W3C WSDL date format).

startPosition->latestCreatedAt Optional Used to paginate through large number of activity responses. The latestCreatedAt is returned by the previous call’s response field newStartPosition->latestCreatedAt. (W3C WSDL date format).
startPosition->oldestCreatedAt Optional Used to paginate through large number of activity responses. The oldestCreatedAt is returned by the previous call’s response field newStartPosition->oldestCreatedAt. (W3C WSDL date format).

Request XML

Response XML

Note that within <activityRecord> elements, the <id> element is being replaced by the <marketoGUID> element as unique identifier.  This change will occur in Spring 2017 release.  For additional information, please see this post.

Sample Code – PHP

Sample Code – Java

Sample Code – Ruby