Hello everybody,
I use REST hook trigger in my Zapier application and I think that it would be useful to actually load more examples using the button "Get More Examples" when users of my Zapier application test the trigger on the step "Pick A Sample To Set Up Your Zap". If user previously pulled out some set of the samples sorted by their creation date, they will wait for nothing for 3 minutes (since Zapier makes an attempt to find new entities for the 3 minutes) because the request initialized by this Zapier UI button "Get More Examples" doesn't use the pagination.
During these 3 minutes Zapier consequently requests my server in order to find if there are any new entities. This chain of requests will be stopped only if there are some new entities in the server response during this 3 minutes.
But I think when user clicks "Get More Examples" it's logical to load older entities using the bundle.meta.page
attribute since all the entities are sorted by the creation date in the descending order. Zapier can try to check if there are any new entities and if there are no new entities, try to load some older entities.
Let's say I have 7 clients:
[
{"id":1, "name": "Client #1", "created_at": "2013-01-10 10:10:10"},
{"id":2, "name": "Client #2", "created_at": "2014-01-10 10:10:10"},
{"id":3, "name": "Client #3", "created_at": "2015-01-10 10:10:10"},
{"id":4, "name": "Client #4", "created_at": "2016-01-10 10:10:10"},
{"id":5, "name": "Client #5", "created_at": "2017-01-10 10:10:10"},
{"id":6, "name": "Client #6", "created_at": "2018-01-10 10:10:10"},
{"id":7, "name": "Client #7", "created_at": "2019-01-10 10:10:10"}
]
Using the bundle.meta.limit
parameter the operation.performList
of my trigger returns three the most recent clients:
[
{"id":7, "name": "Client #7", "created_at": "2019-01-10 10:10:10"},
{"id":6, "name": "Client #6", "created_at": "2018-01-10 10:10:10"},
{"id":5, "name": "Client #5", "created_at": "2017-01-10 10:10:10"}
]
When users click the "Get More Examples" button, Zapier can send two requests: one to check the most recent entities (bundle.meta.page
is 0 or unset) and the second to load the clients from the other "page" consequently increasing the bundle.meta.page
parameter each time when users hit this button. Second request can be sent only if there are new entities found by the first request.
If there are no new clients, users will see the 3 old clients, thanks to the bundle.meta.page=2
[
{"id":4, "name": "Client #4", "created_at": "2016-01-10 10:10:10"},
{"id":3, "name": "Client #3", "created_at": "2015-01-10 10:10:10"},
{"id":2, "name": "Client #2", "created_at": "2014-01-10 10:10:10"}
]
If users click "Get More Examples" one more time, the bundle.meta.page
will be set to 3, so the following response will be returned:
[
{"id":7, "name": "Client #7", "created_at": "2019-01-10 10:10:10"}
]
If there are new clients, then Zapier can show them and don't search for the other clients. In that case Zapier UI can provide more samples in all situations when there are more than 3 entities of the requested type on my server.
Thanks.