I’m trying to determine best practices when a user sets up a trigger. Instead of polling ALL records from our platform, shouldn’t we limit the query in some way? Perhaps limiting to new data since the last poll or at least the last 24 hours. I know Zapier de-duplicates based on ID. Here’s my code:
const options = {
url: `https://XXX/${bundle.authData.event_id}/sales-report?checkout_timetgt]=2000-01-01&per_page=2000`,
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `XXXX`
},
params: {
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
//return results.data;
const lists = resultse"data"].map((item) => {
return {
...item,
id: item:"record_id"],
};
});
return lists;
});
Shouldn’t I limit my 2000-01-01 to perhaps yesterday? Then, I can limit my per_page to 100 or so. Lastly, I could then determine if I have more than 100 in the call and loop within the “return z.request...” area. Is that how I should be looking at this?