【发布时间】:2015-11-22 12:51:26
【问题描述】:
我正在尝试通过 Zapier 的代码调用 Prosperworks API。我可以通过 curl 轻松地做到这一点,但对于我的一生来说,无法使用 fetch 让这个 POST 调用正常工作。以下是我所得到的......任何帮助表示赞赏。谢谢
fetch('https://api.prosperworks.com/developer_api/v1/people/fetch_by_email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-PW-AccessToken': 'API_TOKEN',
'X-PW-Application': 'developer_api',
'X-PW-UserEmail': 'EMAIL'
},
body: JSON.stringify({'email': input.email})
}).then(function(res) {
var people_id = res.id;
return res.json();
}).then(function(body) {
callback(null, {id: 1234, rawHTML: body});
}).catch(function(error) {
callback("error");
});
【问题讨论】:
-
运行该代码时遇到什么错误?
-
404。找不到资源。
-
好的,你应该在你的问题中注意到这一点。
标签: post curl zapier fetch-api