Lesson Progress
0% Complete

What is a token?

Paging tokens, often also called “Paging URLs”, are pieces of data returned when you GET a page.

The piece of data, typically a string, is the location of the next page.

So instead of our previous example (having Cyclr increase the “Page” query string by 1 to get the next page), we now need to pull the ‘Token’ data from a response into the next request to get the next page.

How can I use this?

Cyclr has an inbuilt way of handling this situation, called token paging.

For token paging, you will need to set 4 or 5 parameters:

  • page QUERY
    The token for the next page, returned by the previous request.
  • limit QUERY
    The number of contacts per page.
  • sort QUERY
    Sort results by a response field.
  • select QUERY
    You can select to return specific fields from this method.
  • pageType HEADER
    Set to ‘token’ to enable token paging.

Let’s take a look at what these parameters are for.

The “pageType” is only required to tell the API you wish to use “Token” paging. In most APIs it would not be needed. Remember, pageType must be a Header-type parameter

You already know the Limit and Page Parameters from the previous lesson. The “Limit” parameter would be the same as before.

The “page” parameter is mostly the same, but instead of using a number, you now have to use the data from the “nextPage” field at the bottom of the Response Body/Data that you will receive from the API.

To get this to work in Cyclr, you need to create a new connector-level parameter. This parameter is going to be a “ResponseField” type parameter.

A “ResponseField” type parameter will automatically store a value from a response body to use in the next request. It’s target name needs to match the response field name exactly, similarly to a connector field. In this case “nextPage”.

Your Connector level parameters should look like this:

How to link ‘page’ and ‘nextPage’ parameters

You can link the page and nextPage parameters by setting the parameter values on both to the same value (using the menu on the right of the Parameters tab). This value is “CYCLR_PAGE_TOKEN”.

Set this value by clicking on the “parameter values” icon of the page and nextPage parameters, and enter the CYCLR_PAGE_TOKEN value.

Cyclr will recognize this value and move the ResponseField value into the Query String of the next call, getting you the next page.

Remember to fully test your list methods that are using this new paging. You will need to uninstall and reinstall the connector since you have made Connector level changes.