I need to make two api calls in single action. how can I do that. anybody know kindly write answer.
Hi
Good question.
Please elaborate more about which app API requests you are trying to make in order for us to have more context, thanks.
If you are building your own custom action (developer.zapier.com) or using a code block then you can make as many calls as you want until you hit time out limits... code blocks are limited to 10 seconds on paid accounts & custom actions time out after 30.
We are building our own custom action by using a code block. In our case, we need to make a request to find users by using their email addresses and then create a meeting with those users.
Code block doesn’t allow us to write async & await code. It would be helpful if you could share a sample code or document on how to make multiple API requests in a custom action in the code block.
A code block allows you to use fetch.. usually i write something along the lines of:
const request = await fetch(url,options);
const data = await request.json
When i am in a code block.
When building a custom action in developer.zapier.com you can switch to code mode and use z.request
//first request
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
//results is what is stored in the json response
//you can then use data to make another call.
return z.request(moreOptions)
.then((secondResponse) => {
secondResponse.throwForStatus();
const secondResultSet = secondResponse.json;
return secondResultSet
})
})
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.