Mandrill:请输入一个数组
Posted
技术标签:
【中文标题】Mandrill:请输入一个数组【英文标题】:Mandrill: Please enter an array 【发布时间】:2014-01-16 12:35:53 【问题描述】:我不明白为什么我得到一个无效数组!
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\"]"
【问题讨论】:
【参考方案1】:to数组不应该是
[to]=>
array(
[0]=>array(
[email] => "myemail@gmail.com",
[name] => "myname",
[type] => "to"
)
)
【讨论】:
以上是关于Mandrill:请输入一个数组的主要内容,如果未能解决你的问题,请参考以下文章
将 Java 字符串数组或 JSON 字符串转换为 Javascript 数组(Parse.com Cloud Code 和 Mandrill)