Mailchimp api v3 - can't create segment based

2020-04-16 01:42发布

问题:

I'm trying to create a segment based on a new merge field of type TEXT that I just created, by using condition_type = TextMerge since it seems to be the only option from their documentation that matches my field: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/#create-post_lists_list_id_segments

However, the description for TextMerge looks identical to EmailAddress. To be more specific they both apply only for the EMAIL / MERGE0 field.

TextMerge vs EmailAddress

I tried the following combinations for 'conditions':

{
    'condition_type': 'TextMerge',
    'field': 'EVENTS',
    'op': 'contains',
    'value': 'test'
}

and

{
    'condition_type': 'TextMerge',
    'field': 'EMAIL',
    'op': 'contains',
    'value': 'test'
}

The first one returns an error:

{
    "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":"",
    "errors":
    [
        {
            "field":"options.conditions.item:0",
            "message":"Data did not match any of the schemas described in anyOf."
        }
    ]
}

The second one works.

My question is: how can I create a segment based on a custom merge field of type TEXT? To me this looks like a bug from their side. Did anyone else have this problem? Does anyone have a solution?