I'm having some real difficultly trying to send multiple email addresses in json to the sendgrid API.
Here is my code that works for one email address:
@result = HTTParty.post("https://api.sendgrid.com/api/newsletter/lists/email/add.json",
:body => { :list => "#{@survey.name}_#{@survey.id}", :data => '{ "name": "John Smith", "email": "john@smith.com" }', :api_user => 'XXXXX', :api_key => 'XXXXX'})
But in ruby using the :data post attribute how can I add another email address?
The following don't work - life would be too easy lol
:data => '[{"email" => "nick@sendgrid.com"},{"email" => "jane@example.com"}]'
OR
:data => '{[{"email" => "nick@sendgrid.com"},{"email" => "jane@example.com"}]}'
Apparently SendGrid expects the following....
data[]={"email" => "nick@sendgrid.com"}&data[]={"email" => "jane@example.com"}
How I can create a post parameter in rails that does this?!?