问题
The ADDRESS is a Merge Field but the documentation (http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/) is not clear on how to pass it to the API, since it has sub fields for street, zip, city etc. Does anybody have an example how to do this?
回答1:
This JSON works:
{
"addr1" : "first line",
"addr2" : "second line",
"city" : "city",
"state": "state",
"zip": "zip code",
"country": "country"
}
It's documented in schema here: https://us1.api.mailchimp.com/schema/3.0/Lists/Members/MergeField.json
回答2:
Merge fields can pass like this:
'FNAME' => $contact->first_name,
'LNAME' => $contact->last_name,
'ADDRESS' => (Object)[
'addr1' => $contact->fulladdress,
//'addr2' => $contact->address2,
'city' => $contact->city,
'state' => $contact->state_region,
'zip' => $contact->zip_postal_code,
'country' => $contact->country->shortcode,
'language' => $contact->language->code,
],
来源:https://stackoverflow.com/questions/38401025/how-to-create-list-member-with-address-using-mailchimp-api-v3