AnsweredAssumed Answered

getting all leads from REST API - lead IDs are not sequential

Question asked by d455d978dc6610faa85cb9057ce6a95f1d114044 on Jun 17, 2016
Latest reply on Jun 20, 2016 by d455d978dc6610faa85cb9057ce6a95f1d114044

We are trying to get all the leads using the method mentioned here:
http://developers.marketo.com/blog/get-all-leads-from-the-marketo-rest-api/

and in particular the programatic way referenced from there to here:

Get all leads programmatically in Marketo v1 - Stack Overflow

 

The problem is, that in the account we test with, the leadIds are combined of 2 different sequence of numbers, one that starts at 1 (and currently for the instance we check ends at around 16,000), and one that starts at around 1,000,000 (1 million).  They interlace each other, and we don't know what's the reason and logic behind this.

 

This means that if we try to get the last lead ID using "get activities" for activity type 12 (new leads), we might get say something like 16,000 but we also might get something like 1,000,000 and it's a matter of luck. It also means that if we do get the millions, there would be a huge gap where we would query IDs that are simply not there (say between around 16,000 in our case, and million).

 

Any idea about the following:

1. What's the logic in the lead ID numbering?

2. Considering this, how can we get all the leads? The algorithm described above assumes the leads IDs are sequential, but this does not seem to be the case.

 

Thanks! 

Outcomes