Array param does not work

Hello,

in my code, the array param does not work.

reponse = RestClient.post(
https://mandrillapp.com/api/1.0/messages/send.json’,
{:key => “XXXXXXXXXXXXXXXXX”,
:message => {
:html => ’

testeeeee
',
:text => ‘Example text content’,
:subject => ‘example subject’,
:from_email => ‘[email protected]’,
:from_name => ‘Pedreco’,
:to => [
{:email => ‘[email protected]
]
}
})

But if a remove this code: “:to => [{:email => ‘[email protected]’]”

the code work.

Could you help me?

Thanks!!

On Wed, Dec 4, 2013 at 2:14 PM, [email protected] wrote:

testeeeee
',
:text => ‘Example text content’,
:subject => ‘example subject’,
:from_email => ‘[email protected]’,
:from_name => ‘Pedreco’,
:to => [
{:email => ‘[email protected]

Right here you forgot to close the hash.

On Wednesday, 4 December 2013 21:20:36 UTC-5, [email protected]
wrote:

{:key => “XXXXXXXXXXXXXXXXX”,

the error:

{“status”:“error”,“code”:-2,“name”:“ValidationError”,“message”:“Validation
error: {"message":{"to":["Please enter an array"]}}”}
I’m using the Mandrill API.

RestClient sends requests as application/x-www-form-urlencoded by
default,
so your data is getting flattened out. Try adding { :content_type =>
:json
} as the last argument to your call.

You may also want to evaluate what you need to do that isn’t already
covered by the vendor-supported Mandrill API gem:

https://bitbucket.org/mailchimp/mandrill-api-ruby/

–Matt J.

Hi tamouse,

thank you your replay.

I close the hash but the erro continues, see:
My code:

reponse = RestClient.post(
https://mandrillapp.com/api/1.0/messages/send.json’,
{:key => “XXXXXXXXXXXXXXXXX”,
:message => {
:html => ‘testeeeee’,

:text => ‘Example text content’,
:subject => ‘example subject’,
:from_email => ‘[email protected]’,
:from_name => ‘Pedreco’,
:to => [{:email => ‘[email protected]’}]
}
})

the error:

{“status”:“error”,“code”:-2,“name”:“ValidationError”,“message”:“Validation
error: {"message":{"to":["Please enter an array"]}}”}
I’m using the Mandrill API.

Thank’s!!!