【发布时间】:2020-05-24 20:56:56
【问题描述】:
我正在 Zapier 中为我们的应用程序设置 Zap。 但是,让 Zap 以正确的格式传递数据时遇到了一些麻烦。 默认情况下,Zapier 似乎将数据作为 json 请求正文传递,但我们的后端只接受表单数据。
是否可以将 Zap 配置为通过表单数据发送?
在下面的代码中,我尝试将数据作为params 和body 发送,但我的后端没有任何作为表单数据:
const options = {
url: '${URL}',
method: 'POST',
headers: {
'Authorization': ${token},
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
'phone': bundle.inputData.phone,
'email': bundle.inputData.email,
'dialog': bundle.inputData.dialog,
'name': bundle.inputData.name
},
body: {
'name': bundle.inputData.name,
'email': bundle.inputData.email,
'phone': bundle.inputData.phone,
'dialog': bundle.inputData.dialog
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = z.JSON.parse(response.content);
// You can do any parsing you need for results here before returning them
return results;
});
非常感谢任何输入!
【问题讨论】:
标签: zapier