我只是想在MailChimp列表中添加一个新成员。但我一直收到以下错误,并且不能理解为什么:
type: http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
title: Invalid Resource
status: 400
detail: The resource submitted could not be validated. For field-specific details, see the 'errors' array.
instance:
errors:
0:
field:
message: Schema describes object, NULL found instead
这很奇怪,因为我正在发送正文中的确切对象,详见docs中的exampled:
{"email_address":"urist.mcvankab+3@freddiesjokes.com", "status":"subscribed"}
我在Postman以及MailChimp Playground尝试了这个电话。我在这里省略了JSON中的内容吗?
答案 0 :(得分:6)
所以我也陷入困境,事实证明你需要“merge_fields”。使它成为一个空对象,
{
"email_address": "blahblar@blarblah.com",
"status": "subscribed",
"merge_fields": {
}
}
答案 1 :(得分:2)
确保将帖子数据编码为json。例如在python中:
import requests
import json
data = {
"email_address": "test_email@gmail.com",
"status": "subscribed",
"merge_fields": {}
}
result = requests.post(<YOUR URL>, auth=<YOUR AUTH CREDS>, data=json.dumps(data))
答案 2 :(得分:0)
问题出在网址中。您必须在网址末尾有成员:
var my = _context.Clients.Join(_context.Consultants, cli => cli.consultantID, con => con.ConsultantId,
(cli, con) => new
{
aClient = cli,
aConsultant = con
}).Join(_context.ClientPhone.Where(ph => ph.PrimaryPhone), cli => cli.aClient.ClientCNIC, ph => ph.ClientCNIC, (cli, ph) => new
{
cli.aClient,
cli.aConsultant,
aPhone = ph
}).Join(_context.clientemail.Where(e => e.PrimaryEmail), cli => cli.aClient.ClientCNIC, e => e.ClientCNIC, (cli, e) => new
{
cli.aClient,
cli.aConsultant,
cli.aPhone,
aEmail = e
}).Join(_context.ITRStatus, cli => cli.aClient.ClientCNIC, itr => itr.ClientCNIC, (cli, itr) => new
{
cli.aClient,
cli.aConsultant,
cli.aEmail,
cli.aPhone,
aItr = itr
}).Join(_context.ClientStatus, cli => cli.aItr.ClientstatusId, ss => ss.clientstatusId, (cli, ss) => new
{
cli.aClient,
cli.aConsultant,
cli.aEmail,
cli.aItr,
cli.aPhone,
aStatus = ss
}).Select(s => new
{
s.aClient.clientName,
s.aClient.ClientCNIC,
s.aClient.ClientPassword,
s.aConsultant.ConsultantName,
s.aEmail.Email,
s.aPhone.Phone,
s.aStatus.StatusString
}).ToList();
return View(my);
答案 3 :(得分:0)
我正在使用节点应用程序,这对我有用,而不是使用
url: 'https://blabla.api.mailchimp.com/3.0/lists/{list_id}/members'
试试这个 JavaScript 对象:
const data = {
members:[{
email_address: email,
status: "subscribed",
merge_fields: {
FNAME : firstName,
LNAME : lastName }
}]
};
并使用网址:
url: "https://us7.api.mailchimp.com/3.0/lists/{list_id}"
注意:您必须将 JavaScript 对象转换为 JSON