提交的资源无法验证:Mailchimp
Resource submitted could not be validated: Mailchimp
因为这是我在 Whosebug 上的第一个问题,我希望我能为您提供足够的问题细节以便解决它。如果您需要任何进一步的信息,请随时询问。
简而言之,我正在尝试为简报创建一个简单的注册页面,将订阅者添加到 Mailchimp。
在 terminal/command-line 我收到这条消息:
{
输入:'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/',
标题:'Invalid Resource',
状态:400,
详细信息:"The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
实例:“4d92a5b7-20fb-4f1c-be19-fbcd6548e745”,
错误:[
{
场地: '',
消息:'Required fields were not provided: email_address'
}
]
}
我的 HTML-body 看起来像这样:
`
<img class="mb-4" src="images/logo.png" alt="" width="172" height="172">
<h1 class="h3 mb-3 font-weight-normal">Signup to our Newsletter</h1>
<input type="text" name="fName" class="form-control top" placeholder="First Name" required autofocus>
<input type="text" name="lName" class="form-control middle" placeholder="Last Name" required>
<input type="email" name="email" class="form-control bottom" placeholder="Email" required>
<button class="btn btn-lg btn-primary btn-block btn-sign-up" type="submit">Sign me up!</button>
<p class="mt-5 mb-3 text-muted">© PB Plus 2017-2020</p>
`
这是我的 Javascript 的 'POST' 部分:
app.post("/", function(req, res) {
const firstName = req.body.fName;
const lastName = req.body.lName;
const mail = req.body.email;
const data = {
members: [{
email_adress: mail,
status: "subscribed",
merge_fields: {
FNAME: firstName,
LNAME: lastName
}
}]
};
var jsonData = JSON.stringify(data);
const url = "https://us4.api.mailchimp.com/3.0/lists/fae76eccaf";
const options = {
method: "POST",
auth: "xavier1:6cbb8e0a03109b3b2ef74adc0127f986-us4"
}
const request = https.request(url, options, function(response) {
if (response.statusCode === 200) {
res.sendFile(__dirname + "/succes.html");
} else {
res.sendFile(__dirname + "/failure.html");
}
response.on("data", function(data) {
console.log(JSON.parse(data));
})
})
request.write(jsonData);
request.end();
})
如果有人知道我做错了什么,请告诉我!提前致谢。
好吧,在花了很多时间找出问题所在之后,我输入了 email_adress 而不是 email_address。问题解决了。
因为这是我在 Whosebug 上的第一个问题,我希望我能为您提供足够的问题细节以便解决它。如果您需要任何进一步的信息,请随时询问。
简而言之,我正在尝试为简报创建一个简单的注册页面,将订阅者添加到 Mailchimp。
在 terminal/command-line 我收到这条消息:
{ 输入:'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/', 标题:'Invalid Resource', 状态:400, 详细信息:"The resource submitted could not be validated. For field-specific details, see the 'errors' array.", 实例:“4d92a5b7-20fb-4f1c-be19-fbcd6548e745”, 错误:[ { 场地: '', 消息:'Required fields were not provided: email_address' } ] }
我的 HTML-body 看起来像这样:
`
<img class="mb-4" src="images/logo.png" alt="" width="172" height="172">
<h1 class="h3 mb-3 font-weight-normal">Signup to our Newsletter</h1>
<input type="text" name="fName" class="form-control top" placeholder="First Name" required autofocus>
<input type="text" name="lName" class="form-control middle" placeholder="Last Name" required>
<input type="email" name="email" class="form-control bottom" placeholder="Email" required>
<button class="btn btn-lg btn-primary btn-block btn-sign-up" type="submit">Sign me up!</button>
<p class="mt-5 mb-3 text-muted">© PB Plus 2017-2020</p>
`
这是我的 Javascript 的 'POST' 部分:
app.post("/", function(req, res) {
const firstName = req.body.fName;
const lastName = req.body.lName;
const mail = req.body.email;
const data = {
members: [{
email_adress: mail,
status: "subscribed",
merge_fields: {
FNAME: firstName,
LNAME: lastName
}
}]
};
var jsonData = JSON.stringify(data);
const url = "https://us4.api.mailchimp.com/3.0/lists/fae76eccaf";
const options = {
method: "POST",
auth: "xavier1:6cbb8e0a03109b3b2ef74adc0127f986-us4"
}
const request = https.request(url, options, function(response) {
if (response.statusCode === 200) {
res.sendFile(__dirname + "/succes.html");
} else {
res.sendFile(__dirname + "/failure.html");
}
response.on("data", function(data) {
console.log(JSON.parse(data));
})
})
request.write(jsonData);
request.end();
})
如果有人知道我做错了什么,请告诉我!提前致谢。
好吧,在花了很多时间找出问题所在之后,我输入了 email_adress 而不是 email_address。问题解决了。