I am using the GetLeadsByProgramID REST API endpoint to get the Leads with Status under a Program in Marketo. But is there any way where I can get the status of only 1 lead for a program?
1 Answers
First, an advice:
As Marketo applies some limits for accessing the API (most importatntly: Daily Quota, Rate Limit, Concurrency Limit), it is considered to be a good practice to fetch as many records as you can with one API call and cache the results. You can allways loop through and filter out the result set as needed.
A solution:
With that said, you can still fetch the program status of one particular lead, but with not the GetLeadsByProgramID endpoint. Unfortunately that endpoint does not allow filtering based on lead Id.
The program status change of a lead is also an activity, and luckily there is an endpoint, Get Lead Activities to query just that. You need to have four things before making the call:
- A paging token –obtained from the Get Paging Token endpoint–, that also defines the earliest datetime to retrieve activities from.
- The Id of the “Change Status in Progression” activity type, which can be gathered from the Get Activity Types endpoint. It is 104 in my case, but this is not guaranteed to be the same in all instances.
- The Id of your Lead object in question. I assume you have that on record.
- The Id of the Program you checking statuses for. I guess you have that on record too. It can be fetched via the API too, but that is also present in the url when you click on the program in your instance. E.g.: if your link is https://app-abc01.marketo.com/#ME1234A1, the Program Id is 1234.
So, having all that info at hand you can make the call as described at the Activities Endpoint Reference page. In essence this is the url you have to call:
GET /rest/v1/activities.json?nextPageToken=<YOUR_NEXPAGE_TOKEN>&activityTypeIds=104&leadIds=<LEAD_ID>&assetIds=<PROGRAM_ID>
The response will contain all the program status changes of the Lead in the given Program after the given datetime. So you still might need to perform a loop in case there are multiple status changes.
You can decide if all this worth the effort.

- 7,918
- 12
- 41
- 49
-
1Thanks for the wonderful explanation. When the Member Status Changes, I am able to send the Program ID and the Lead ID using webhook. I am using a custom field which sends the member status but this needs to be configured for each status change (i want to avoid this) Now that you have mentioned about "datetime", if there is any way to send the current time of the system in webhook (i really want to avoid using a dummy field here). This way i can update the CRM system with the member status changes Let me try all your suggestion, and will reply with what i was able to achieve. – Brijesh Shetty May 03 '18 at 14:04
-
1Wow, i just tried this....Excellent result...this is what i was looking for in the result { "name": "New Status", "value": "Attended" }, { "name": "Old Status", "value": "Added" } – Brijesh Shetty May 03 '18 at 14:22
-
I am glad it helped! – dferenc May 03 '18 at 20:35
-
I am also trying some stuff for data migration, i have posted the details on https://stackoverflow.com/questions/50170714/marketo-find-field-mapping-for-program-id-and-sfdc-campaign-id If you have any solution kindly share – Brijesh Shetty May 04 '18 at 08:41