How to call a lead in a specific partition through Marketo API?
Hi everyone,
My marketo account has multiple partitions (partition A, partition B, partition C, etc). I am trying to create a python program that will get me certain data about leads in partition B.
I have the below code that's setup and working but the leads in the results don't belong to partition B and I'm not able to find any data with leads IDs that belong to partition B.
import marketorestpython.client
import requests
import json
from marketorestpython.client import MarketoClient
munchkin_id = "munchkinID"
client_id = "clientID"
client_secret= "clientsecret"
args = {'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret}
host = f'https://{munchkin_id}.mktorest.com'
# Enter your Marketo API credentials here
marketo_client_id = client_id
marketo_client_secret = client_secret
# Get the lead id from the user
lead_id = [21286327]
# Create a Marketo client object
mc = MarketoClient(munchkin_id, client_id, client_secret)
# Get the activity log for the lead
activities = mc.execute(method='get_lead_activities', activityTypeIds=["2", "1"], sinceDatetime='2023-04-23T02:41:00Z')
# Filter the activities to only include activities for the lead with the ID 20017335
filtered_activities = list(filter(lambda activity: activity['leadId'] == lead_id[0], activities))
# Print the filtered activities
for activity in filtered_activities:
print(activity)
Do you guys know if I'm missing out on some detail here as to why leads from partition B are not showing up? OR better yet, is there a way to filter data with the partitionName or partitionID?