mailchimp-api icon indicating copy to clipboard operation
mailchimp-api copied to clipboard

Cannot POST physical address merge fields

Open ARH-Digital opened this issue 7 years ago • 3 comments

When adding a new user, I can use the post method to add a user without issue, however, if I post a new user and include the ADDRESS merge_fields, there are always errors.

Using the same data to PUT or PATCH an existing user works, I just seem to be unable to send a physical address when creating a user.

I am not entirely convinced that this is an issue with your package and may be an issue with MailChimp, but thought I would check here first.

New user request - fails

    'body' => '{"status":"subscribed","email_address":"[email protected]","merge_fields":{"FNAME":"Fredy","LNAME":"Reichert","PHONE":"987654321007","ADDRESS":{"addr1":"925 Isobel Reach","city":"South Lorenberg","state":"QLD","zip":4000,"country":"AU"}}}'

The error given from Mailchimp isn't very helpful,

    detail":"The resource submitted could not be validated. For field-specific details, see the \'errors\' array.","instance":"bd02cc41-1146-41a7-ad80-7aae2189f702","errors":[{"field":"merge_fields.ADDRESS","message":"Data did not match any of the schemas described in anyOf."

Yet the exact data made in 2 requests instead of one appears to work. New User request - Works

    'body' => '{"status":"subscribed","email_address":"[email protected]","merge_fields":{"FNAME":"Fredy","LNAME":"Reichert","PHONE":"987654321007"}}'

Update User request with address - works

    'body' => '{"status":"subscribed","email_address":"[email protected]","merge_fields":{"FNAME":"Fredy","LNAME":"Reichert","PHONE":"987654321007","ADDRESS":{"addr1":"925 Isobel Reach","city":"South Lorenberg","state":"QLD","zip":4000,"country":"AU"}}}'

ARH-Digital avatar Jan 10 '19 07:01 ARH-Digital

Did you get anywhere towards solving this?

drewm avatar Mar 19 '19 11:03 drewm

No. I ended up not putting a physical address in MailChimp. It might just be a limitation of Mailchimp that it could not all be done at once. Storing the physical address was a nice to have, not a requirement so I was able to leave out that functionality.

ARH-Digital avatar Apr 24 '19 04:04 ARH-Digital