Skip to main content
Announcements
[WEBINAR] Accenture & Qlik: Accelerating BI Migration to SaaS with Qlik on Dec 13th: REGISTER

How to implement pagination using Call Url block in an automation

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
AfeefaTk
Support
Support

How to implement pagination using Call Url block in an automation

Last Update:

Jan 11, 2022 4:27:15 AM

Updated By:

AfeefaTk

Attachments

This article explains how to handle pagination using Call URL block 

Here we are mainly discussing two different types of pagination 

  • Page-based Pagination
  • Cursor-based Pagination

Basically, the call URL block will only execute once or do one API call. It does not support pagination by itself, but you can construct the next page manually by checking if there is a Next Link attribute (cursor-based pagination) or if there are any other attributes indicating the presence of more records (page-based pagination)

For page-based pagination, let's take an example of Zoho CRM rest API. Say for eg, We are using call URL block to get all contacts from Zoho crm

The first call always lists out x number of items. We have to construct a loop in order to perform pagination.Please follow the below steps

  • Initialize a variable with name count and set the value to 0
  • If the page should be started from 1, use the same count variable and add 1 as a value
  • Skip the above step if the page should  be started from 0
  • Use 'Go To Label' block which allows you to jump to another section in your automation
  • On the right side of automation, use the 'Label' block
  • Drag and drop Call URL block and fill in appropriate fields
  • In the Call URL block, there will be 2 query params called page(indicates page number) and per_page(indicates the size of the page)
  • Page value should equal to {$.count}
  • Increment count variable by 1
  • Add a condition block to check if the 'more_records' attribute from the response of the call URL block is true
  • If it's true, continue to execute the call URL block  by using 'Go To Label' block
  • If there are no more records, break the loop to stop paginationpage-base-pagination-flow.PNG

Please find the attached JSON file containing an example automation workspace demonstrating page-based pagination using call URL block

For cursor-based pagination, let's go over an example of HubSpot rest API. Say for eg, We are using call URL block to get the list of companies from Hubspot

Steps to follow

  • Beneath the start block use the 'Go To Label' block which allows you to jump to another section in your automation
  • On the right-hand side, use the 'Label' block
  • Add Call URL block and fill in appropriate fields
  • In the Call URL block, there will be 2 query params called after(indicates cursor value to go to the next page) and limit(indicates the size of the page)
  • During the first run of the call URL block, the after parameter (cursor) value will be null
  • Add a condition block to check if the 'paging.next.link' attribute from the response of the call URL block is not empty
  • Add a custom code block and write coding stuff in order to fetch the cursor value from the response of the call URL block
  • If the condition is true, execute the call URL block until the paging stops

cursor-based-pagination.PNG

Please find the attached JSON file containing an example automation workspace demonstrating cursor-based pagination using call URL block

Follow the steps provided in this article Upload Automation Workspace  to import the automation from shared JSON file

Labels (2)
Contributors
Version history
Last update:
‎2022-01-11 07:27 AM
Updated by: