Additional pagination type "pages" for declarative style nodes

The idea is:

I am currently creating a custom n8n node in declarative style (RoutingNode) which should paginate an Magento REST endpoint.
Magento uses for pagination two query parameters.

  • searchCriteria[currentPage]
  • searchCriteria[pageSize]

I already created declarative nodes using the offset pagination type. This works well if the API needs a record offset.
In my case I need to iterate over pages. This approach already works in the HTTP node by defining a query parameter and use the internal variable $pageCount.
In declerative style this variable is not available.

IMHO there are several possibilities:

  1. Extend the existing offset type by a new parameter to define a incmrent for theoffsetParameter.
  2. Introduce a new pagination type pages

My use case:

I tried to define the pagination with generic. In general this works, but it call then first the API without pagination.

This is an example for Magento:

pagination: {
	type: 'generic',
	properties: {
		continue: '={{ $response.body.items.length > 0 }}',
		request: {
			qs: {
				'searchCriteria[currentPage]': '={{ $response.body.search_criteria.current_page ? $response.body.search_criteria.current_page+1 : 1 }}',
				'searchCriteria[pageSize]': 20,
			}
		}
	}
}

I think it would be beneficial to add this because:

This helps to create more nodes which uses pagination in an easy way.
This reduces the amount of time to build workflows, because most the time we do not have to handle loops.

Any resources to support this?

I found the code in the HTTP node tests useful and had a look into the source code of the RoutingNode.

Are you willing to work on this?

I can try it or support by testing it.