Get All Lead Activities for Given Activity Type

Jonathan_Marzin
Level 2

Get All Lead Activities for Given Activity Type

Has anyone run across a problem comprehensively gathering all lead activity for a given activity type? I’m finding gaps in my data even though I’m keeping track of all my datetime cursors.

So I have a script that uses the "Get Lead Activity" REST API call and queries activity type IDs [6, 7, 8, 9, 10, 11, 27]. If I make the call at 2016-02-17 22:15 UTC for all data since 2016-02-17 18:15 UTC, I capture both dates in a database table so that I know the last date range I requested those activity types. So when I next make the API call, my sinceDatetime would then be 2016-02-17 22:15 UTC. I even add a one minute buffer to make sure I don’t miss anything.

However, I’m noticing that the counts of each activity type don’t match with the campaign numbers in the Marketo UI. How else can I ensure that I’m capturing all activity?

2 REPLIES 2
Anonymous
Not applicable

Re: Get All Lead Activities for Given Activity Type

FYI I haven't looked to see if I am experiencing this problem but I found the most effective way to sync the data is to use the latest activity_at for the since. So instead of storing the time cursor, you actually query for the latest time by activity type id and thats what you use. I think this might be better because I assume Marketo is syncing these roughly in time order.

Jonathan_Marzin
Level 2

Re: Get All Lead Activities for Given Activity Type

Not a bad idea, assuming Marketo does indeed write the data in time order. If I go that route, I think I would still factor in a buffer just to make sure.

I really think they should provide a parameter that is linked to the timestamp that the activity records are written to their database (like an insert_date_time). I would be guaranteed to get all records that way regardless of how they sync the data.