Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mandrill: Please enter an array

Tags:

mandrill

I can't understand why I get an Invalid array!

response = Unirest.post "#{@@endpoint}/messages/send.json", 
                        headers:{ "Accept" => "application/json" }, 
                        parameters:{ 
                            :key => @@apikey, 
                            :message => {
                                :text => "example text",
                                :subject => "bla bla",
                                :from_email => "[email protected]",
                                :from_name => "site.com",
                                to: [
                                        {
                                            :email => "[email protected]",
                                            :name  => "myname",
                                            :type  => "to"
                                        }
                                ]
                            }
                        }

I get this error

{"status":"error","code":-2,"name":"ValidationError","message":"Validation error: {\"message\":{\"to\":[\"Please enter an array\"]}}"}
like image 845
sparkle Avatar asked Dec 29 '13 13:12

sparkle


1 Answers

Shouldn't the to array be

[to]=> 
   array( 
       [0]=>array(
                [email] => "[email protected]",
                [name]  => "myname",
                [type]  => "to"
                )
        )
like image 159
ravibalgi Avatar answered Dec 27 '22 04:12

ravibalgi