Best answer

Recommended way, REST hooks vs pagination?

  • 4 January 2021
  • 4 replies
  • 823 views

Userlevel 2
Badge

I’m developing a Zapier integration against an underlying Graphql API using cursor based pagination.

What is the recommended way to build my triggers;

  1. Using polling, and implement some js code to “support” cursor based pagination - any links on how to do this?
  2. Using REST hooks. I looked at one of the Github repositories, and it seems like it’s not super active - are REST hooks preferred over polling or?

Thanks for helping me out :)

icon

Best answer by ikbelkirasan 4 January 2021, 12: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.

4 replies

Userlevel 7
Badge +12

@alexb - If you want your triggers to run instantly then go for webhooks. Otherwise, polling triggers should be fine.

More info on how to use cursors in a trigger can be found here: https://platform.zapier.com/cli_docs/docs#paging

Userlevel 2
Badge

Thanks for the answer - I will stay with polling then. It makes sense that the polling query needs pagination. Regarding the documentation in the link above - I’m a bit confused as to why it mentions dropdowns? As that simply because the way of pagination is the same as for the polling trigger?

Userlevel 7
Badge +9

@alexb “pagination” is a concept specific to triggers that populate dropdowns.  When the user selects “load more” in the dropdown we call the trigger again, passing the page parameter, so you can make the appropriate request to your API for the next set of data.  Pagination as described is not a concept that is germane to regular, Zap runtime, polling trigger execution.

 

In your polling triggers you can make multiple requests to pull back more than one page of data if you need to, but you’re in control of that - the platform itself isn’t going to make paging requests when the Zap is running.  

 

Let us know of that doesn’t make sense.  There’s a good bit of overloading of context when we discuss triggers - Zap Editor execution vs Zap runtime execution; and trigger execution to populate a dropdown vs trigger execution to support a Zap runtime polling execution.  So it’s natural for it to be a little unclear at first, unfortunately.  

Userlevel 2
Badge

Hi @Zane .

Thanks for your answer - I’m interested in Zap runtime polling execution 😅

I actually asked a more refined question here, where you can maybe help answer one of the things I currently don’t understand how to achieve speaking about runtime polling execution?