Best answer

How to loop create action with pagination

  • 10 January 2023
  • 1 reply
  • 427 views

Hi all… iam new in Zapier integration platform.

let me tell you what iam done before.

 

I’ve API to get local business information like phone, website, address, etc worldwide.

then i want to implement our api to Zapier platform

 

My integration already on public beta, and i just have 1 trigger (for select option only) and 1 create action for searching data.

 

The flow I want to build is simple.
1) user search data then save data into spreadsheet

 

But, the problem is, my API is using cursor for pagination, and iam still confuse regarding how to perform create action (searching data) continuously with next cursor.

 

Help me please.

  1. what the best method for trigger app if the flow like above
  2. give me example about how to perform create action (searching data) with next cursor from response and continuously

Thank you

icon

Best answer by Christian W 12 January 2023, 05:09

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 1
Badge +1

Hi there!

I can see that you have written in to our Support channels in addition to this post, and as your request is pursuant to some specific details of your integration, I’ll reply to you there so that we can dig into the specifics together.

For the sake of providing some publicly accessible information on this thread though, you can find a great resource about pagination in Zapier integrations in our documentation.

Generally speaking, pagination is supported only on triggers which serve to populate a dynamic dropdown menu with options (as you’ve correctly identified). This is because a within the context of a dynamic dropdown, the following process is possible:

  1. A user will open the dropdown menu, causing the trigger to fetch the first page of data from your API
  2. That data is transposed by your Zapier integration into options for the dropdown menu
  3. The user can click the “See more” button to prompt Zapier to use your trigger to fetch the next page of data from the API

The specifics of implementing pagination will depend on the requirements of your API, which we can discuss further in your Support ticket. At the high level though, this works by:

  • Referring to the page number that Zapier tracks for you in `bundle.meta.page`. This will be incremented automatically each time the user clicks the “See more” button
  • After collecting the first page, set a cursor by calling `z.cursor.set()` and passing the appropriate value from your API response
  • When collecting subsequent pages, collect that cursor by calling `z.cursor.get()` and using the result in the API request (to ensure the data returned starts where the previous request left off)

I hope this helps to provide some high-level context, and I’ll be in touch with you shortly to discuss the specifics of your app via the Support ticket :)