As per the API documentation here https://developer.mailchimp.com/documentation/mailchimp/reference/lists/#create-post_lists_list_id, the API makes it possible to batch subscribe several users, by sending a JSON object containing a members field. That members field is an array of status, email_address and merge_fields.
When sending the following cURL query, I get a response saying the email_address field could not be found.
curl -X POST \
https://us15.api.mailchimp.com/3.0/lists/123456789/members \
-H 'Authorization: Basic SSSSHWONTTELL=' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{"members": [{"email_address": "myuser@yahoo.fr", "status": "subscribed", "merge_fields": {"LNAME": "ANQUE", "FNAME": "PATRICIA"}}]}'
And the response :
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Invalid Resource",
"status": 400,
"detail": "The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
"instance": "xxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"errors": [
{
"field": "email_address",
"message": "This value should not be blank."
}
]
}
The query looks good to me, in respect with the API documentation. I'm probably missing something. Any idea ?
Please note that the query works properly for individual members sent as {email_address:XXX, status:XXX, merge_fields:XXX}, but I wish I could send an array of those.