Paging Tokens

To page through results, or retrieve data updated relative to a given data, Marketo provides paging tokens.

Token Types

There are two related, but distinct, types of paging tokens which Marketo provides:

  • Date-Based
  • Position-Based

Date-Based

The first is a paging token which represents a date.  These are used to retrieve activities, data value changes, and deleted leads which occurred after the date represented by the paging token.  This type of paging token is generated by calling the Get Paging Token endpoint and including a datetime.

The format of the sinceDateTime parameter must conform to ISO 8601 standard date notation.  For best results, use a full datetime that includes the time zone.  The time zone can be represented as either an offset from GMT using the following format:

yyyy-mm-ddThh:mm:ss+|-hh:mm

Or using a captial “Z” as shorthand to represent UTC like this:

yyyy-mm-ddThh:mm:ssZ

Examples

2016-09-15T15:53:00+05:00

2016-09-15T10:53:00Z

Note that because sinceDateTime is a query parameter, it must be URL encoded.

The nextPageToken string is then provided to a Get Lead Activities, Get Lead Changes, or Get Deleted Leads call, and activities are retrieved from after the datetime provided to the Get Paging Token API.

Position-Based

The second type of paging token may be returned by any batch retrieval call to a Lead Database API.  This type of paging token is similar in concept to a database cursor which enables traversal of records.  For example, a Get Leads By Filter Type call may represent a set greater than the given batch size, usually the max and default of 300.  When there are more results, the moreResult field is true in the response, and a nextPageToken is returned.  To retrieve the additional records in the result set, an additional call including nextPageToken with the received value from the previous response in the new call.  The resulting response will return the next page in the result set.