6

我正在使用“操场”来测试创建细分,但我不断收到验证错误

我的请求:

{
    "name": "MyTest",
    "options": {
        "match": "any",
        "conditions": [
            {
                "field": "EMAIL",
                "op": "is",
                "value": "p001@mymaildomain.xxx"
            },
            {
                "field": "EMAIL",
                "op": "is",
                "value": "p002@mymaildomain.xxx"
            }
        ]
    }
}

回应是:

type: http://kb.mailchimp.com/api/error-docs/400-invalid-resource
title: Invalid Resource
status: 400
detail: The resource submitted could not be validated. For field-specific details, see the 'errors' array.
instance:
errors:
    0:
        field: options.conditions.item:0
        message: Data did not match any of the schemas described in anyOf.
    1:
        field: options.conditions.item:1
        message: Data did not match any of the schemas described in anyOf.
4

2 回答 2

8

实际上 JSON 的格式应该如下:

{
    "name":"email based",
    "options":{
                "match": "any",
                "conditions":[
                                {
                                    "condition_type":"EmailAddress",
                                    "field":"merge0",
                                    "op":"is",
                                    "value":"p001@mymaildomain.xxx"
                                },
                                {
                                    "condition_type":"EmailAddress",
                                    "field":"merge0",
                                    "op":"is",
                                    "value":"p002@mymaildomain.xxx"
                                }
                ]
    }
于 2015-12-09T09:23:59.863 回答
1

对于其他也有此问题的人,当您没有为所有已定义的合并字段提供键/值时,也会发生这种情况。如果您在传入合并字段时使用不同的大小写,也会发生这种情况。因此,如果您定义了以下合并字段,无论它们是否按要求设置:

年龄性别

确保始终使用完全相同的情况传递 Age 和 Gender 的键/值对。如果只传入“Age=25”或“age=25”,而没有传入“Gender=”,就会出现上述错误,因为它不是一个设计良好的API。

于 2018-05-16T14:33:50.660 回答