Best answer

Supporting Zapier Transfer with REST Hook triggers from Zapier UI

  • 28 February 2023
  • 3 replies
  • 89 views

Badge

Hey.
In our currently private integration, we want to support Transfers for REST hook triggers. Is it possible to do it in the Zapier UI?

Up until now we had no pagination support. Triggers are configured in Code Mode so there is no “Can paginate” checkbox. Do we have to set in the the code (in Perform List)?
This is how Perform List currently looks like (with pagination attempt).

...

let pageSize = 5;
if (bundle.meta.isBulkRead) {
// Called from Transfer
pageSize = 50;

}

const options = {
url: `${process.env.REST_API_BASE}/objects/search`,
method: 'POST',
body: customBody,
headers: {
'Content-Type':'application/json',
'Accept': 'application/json',
'Authorization': bundle.authData.api_key
},
params: {
per_page: pageSize,
page: bundle.meta.page + 1,
},
};

return z.request(options)
.then((response) => {
response.throwForStatus();

let result = response.json.objects;

return result;
});

 
Hopefully this question makes sense.

Thanks.

icon

Best answer by Mato 6 March 2023, 13:23

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.

3 replies

Badge

It looks like Zapier fails to parse returned json data because it contains null and/or Infinity values.

 

 

Userlevel 4
Badge +9

Hey @Mato 👋

It sounds like you’re working off this documentation already: https://platform.zapier.com/docs/transfer#developing-in-the-cli-vs-the-platform-ui - great!

Though we would recommend working in the CLI for advanced functionality such as Transfer, it should be possible to implement in the UI, using Code Mode. Only if your trigger is a REST hook type trigger and your API uses cursor based pagination, would you be required to work in the CLI to support Transfer currently.

The canPaginate flag that is used for working in the CLI, is only needed for cursor based pagination. From the code above, it looks like your API uses page/limit based pagination so you wouldn’t add additional code in Code Mode in the UI. Have you been able to test that out when setting up a Transfer from https://zapier.com/app/transfers ? Based on that code, I’d expect pages of records to be loaded for you to choose from. 

As for that error message in your comment, were you seeing that when creating a Transfer? To allow us to look into the specific response you’re receiving in the logs, to see if we can tell that null values are causing a problem, you can open a ticket with us from https://developer.zapier.com/contact 👍 Please include a link to the Transfer where you’re seeing the issue and a full page screenshot of the error to give context. 

Badge

Hey @MarinaH 

Thanks for helping. I managed to fix it by not sending null and Infinity json values.

I will open a ticket if it happens again in the future.