【发布时间】:2022-01-11 18:24:14
【问题描述】:
我有两个 API 调用,一个是第二个的输入,我现在将它们定义为两个动作,但我想知道是否可以将它们合并到一个动作中,我在文档中找不到,那可能吗?如何? 我的情况是我有一个创建发票并返回其 id 的操作,然后将 id 传递给另一个 API 以确认该发票并返回一个 pdf。
我应该从后端封装 API 吗?或者如果我在“then”方法中调用第二个 API 是否有效:
const options = {
url: 'https://my.fastbill.com/api/1.0/api.php',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
},
body: {
'SERVICE': 'invoice.complete',
'DATA' : {
'INVOICE_ID': bundle.inputData.INVOICE_ID
}
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// Call the second API here
return results;
});
【问题讨论】:
标签: zapier