0

I have a total of 5 merge fields in the Mailchimp account which are marked as required and assigned to contacts. Need to update two of the merge field using the PATCH API method. But it returns with an error code to update all required merge field value. My use case is to update only two of my fields. Any ideas.

Notes:

merge_fields: MMERGE4,MMERGE5,MMERGE6,MMERGE7,MMERGE8
API: PATCH https://{dc}.api.mailchimp.com/3.0/lists/list_id/members/{member_id}
JSONObject in body:{"merge_fields": {"MMERGE7": "Valid","MMERGE8": "Mailbox Valid"}}

While try to update this it returns with an error code to update all required merge field value.

{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Invalid Resource",
"status": 400,
"detail": "Your merge fields were invalid.",
"instance": "4e565fdc-a62f-4813-88b9-aca06dc99622",
"errors": [
    {
        "field": "MMERGE4",
        "message": "Please enter a value"
    },
    {
        "field": "MMERGE5",
        "message": "Please enter a value"
    }
]

}

  • Are you certain {member_id} actually exists and has valid data in MERGE4 and MERGE5? – Scott C Wilson Jun 11 '20 at 12:10
  • Do the docs say that you can just update a subset of the fields ?? Whenever I update a member I just read its current record and then update the fields I want to change. – blissweb Jun 12 '20 at 02:18

2 Answers2

0

Per the documentation you have to set skip_merge_validation query parameter to true:

...., query: {skip_merge_validation:true}, .....

skip_merge_validation: boolean

If skip_merge_validation is true, member data will be accepted without merge field values, even if the merge field is usually required. This defaults to False. Possible values: true or false.

PeterKA
  • 24,158
  • 5
  • 26
  • 48
0

I'm using https://www.npmjs.com/package/@mailchimp/mailchimp_marketing

The API Mailchimp recommends currently and I've spent too much time trying to figure out merge field the correct way to do it is as follows.

            merge_fields: {
                PHONE: data.phonenumber,
                ADDRESS: {
                    addr1: data.streetaddress,
                    city: 'New York',
                    state: 'NY',
                    zip: data.zip,
                    country: 'US',
                },
                FNAME: data.name,
                MMERGE2: '',
            },
Sporego
  • 376
  • 4
  • 12