The main issue I am running into is with the "Get Lead Activities" API:
https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Activities/getLeadActivitiesUsingGET
For example, if I request all of the interesting moments from the past 90 days for a single lead, it takes 14 calls to the API passing new "nextPageToken" until there are no longer "moreResult" = true responses from Marketo.
This is extremely slow, in our testing, takes about 28 seconds.
In my first request, I pass a nextPageToken that is set at 90 days ago, and for my test Lead with id 835054, they have 2 interesting moments in that time period.
So the result set is much less than 300, which is the total max batch size returned in a single response. So a single response should be able to return all Interesting Moment activities for this lead in the last 90 days.
However it appears the Marketo implementation is not paginating by the batchSize parameter, but instead by some arbitrary period of time represented by each "nextPageToken".
This design approach causes the performance issue by requiring us to execute 14 API calls in what could be returned in 1. 12 of these API calls return no data, that's 12 wasted calls against our API quota in addition to the processing time this adds.
Need help to understand if there is anything we can do on our side, using the Marketo REST API, to improve this performance or if there needs to be a design change/enhancement to this API so that it paginates by returned row count, rather than arbitrary time periods.
Marketo seems to have a less limited/better implementation they use on their own UI as they can return this Leads activities in a single call. So not sure why customers are only given the option to this extremely limited API.
... View more