我无法理解为什么我会得到一个无效数组!
response = Unirest.post "#{@@endpoint}/messages/send.json",
headers:{ "Accept" => "application/json" },
parameters:{
:key => @@apikey,
:message => {
:text => "example text",
:subject => "bla bla",
:from_email => "info@site.com",
:from_name => "site.com",
to: [
{
:email => "myemail@gmail.com",
:name => "myname",
:type => "to"
}
]
}
}
我收到此错误
{"status":"error","code":-2,"name":"ValidationError","message":"Validation error: {\"message\":{\"to\":[\"Please enter an array\"]}}"}
答案 0 :(得分:4)
to数组不应该
[to]=>
array(
[0]=>array(
[email] => "myemail@gmail.com",
[name] => "myname",
[type] => "to"
)
)