I need help with the Marketo Deleted Leads API endpoint. If I am doing this correctly, then it is too slow to be useful and gives really strange results.
I followed the instructions from This page:
and supplied nextPageTokens using
I am trying to pull 10 days worth of deleted leads.
The behavior that I am experiencing is that the response object success = True, and moreResult = true but there is no 'result' data. In looping over this endpoint feeding in the response nextPageToken, I currently am up to 53 total requests to the Get Deleted Leads endpoint, and 50 of the 53 responses have no 'result' data.
This operation took ~25 mins to get 3 deleted leads.
Is this expected behavior?
Yes, this is expected behavior. Referring to https://developers.marketo.com/rest-api/lead-database/activities/#deleted_leads you will find the note:
In some cases, this endpoint may respond with fewer than 300 activity items, but also have the moreResult attribute set to true. This indicates there are additional activities that can be returned and that the endpoint can be queried for more recent activities by including the returned nextPageToken in a subsequent call. Note that the nextPageToken needs to be URL Encoded in the request.
The empty pages you're getting represent 300 leads with updates that haven't been deleted, but were checked by the API to see if they were. The number of requests you need to make will be proportional to the number of leads with updates during the requested time period. It works this way in order to be able to return each result in a timely manner. There is no bulk extract for deleted leads, so this is the best method.