[有限可用性]{class="badge informative" title="仅限于Campaign Standard已迁移的用户"}

筛选 filtering

检索过滤器元数据

每个资源都可以使用过滤器。 要确定与资源关联的筛选器,需要对资源元数据执行GET请求。 此请求会返回URL,其中为给定资源定义了所有过滤器。 有关元数据的详细信息,请参阅此章节

要识别过滤器的元数据并确定其使用方式,必须对之前返回的URL执行GET请求。

示例请求

以下负载示例说明如何为“profile”资源检索“byText”过滤器元数据。 首先对“profile”资源元数据执行GET请求。

-X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/resourceType/profile \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Cache-Control: no-cache' \
-H 'X-Api-Key: <API_KEY>'

它会返回描述过滤器的URL。

{
"filters": {
        "href": "https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/resourceType/<PKEY>/filters/"
    }
  }

对URL执行GET请求。 它会返回用户档案资源的过滤器列表,其中包含与每个过滤器关联的元数据。

{
"birthday": {
        "PKey": "@FL-CbDFXbnHbXcVpeCGWL46VXJLn1LqxLMPagt2vz8sCxQ52lvB15KiUaxXkxJYQw-tZXYrgUWG6K8QcB4gxVY9RKoba5bRFY3294YFshDmorRr8",
        "category": "0150_profile",
        "condition": ...,
        "data": "https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/birthday?type=$value&precision=$value&operator=$value&day=$value&month=$value&includeStart=$value&endDay=$value&endMonth=$value&includeEnd=$value&relativeValue=$value&nextUnitsValue=$value&previousUnitsValue=$value",
        "formType": "webPage",
        "fragmentName": "",
        "label": "Birthday",
}

筛选器元数据结构

每个过滤器都可以使用相同的元数据结构:

  • @formType ​和​ @webPage ​字段是技术字段。
  • data ​字段提供了如何使用过滤器的示例。
  • 元数据 ​节点描述了筛选器参数。
  • 条件 ​节点描述了筛选器的用途。 元数据节点中描述的过滤器参数用于创建过滤器条件。 对于每个筛选条件,如果​ enabledIf ​为true,将应用​ expr

筛选元数据结构示例:

"byText": {
        "PKey": "...",
        "category": "99_none",
        "condition": ...,
        "data": "/profileAndServices/profile/byText?text=$value",
        "formType": "none",
        "fragmentName": "",
        "label": "By name or email",
    }

使用过滤器

筛选对以下请求执行:

GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/<resourceName>/by<filterName>?<filterParam>=<filterValue>

可以在单个请求中组合多个过滤器:

GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/<resourceName>/<filter1name>/<filter2name>?<filter1param>=<filter1value>&<filter2param>=<filter2value>

示例请求

  • 用于检索类型为“email”的“service”资源的示例GET请求。

    code language-none
    -X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/service/byChannel?channel=email \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    对请求的响应。

    code language-none
    {
        "content": [
            {
                "PKey": "<PKEY>",
                "created": "2019-09-25 23:20:35.000Z",
                "href": "https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/service/@I_FIiDush4OQPc0mbOVR9USoh36Tt5CsD35lATvQjdWlXrYc0lFkvle2XIwZUbD8GqTVvSp8AfWFUvjkGMe1fPe5nok",
                "label": "Marketing Newsletter",
                "lastModified": "2019-09-25 23:20:35.000Z",
                "limitedDuration": false,
                "messageType": "email",
                "mode": "newsletter",
                ...
            },
            ...
        ],
        ...
    }
    
  • 用于检索中包含“Doe”的“profile”资源的示例GET请求
    电子邮件或姓氏字段(byText过滤器会搜索电子邮件和姓氏字段)。

    code language-none
    -X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/byText?text=Doe \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    对请求的响应。

    code language-none
    {
        "content": [
            {
                "PKey": "<PKEY>",
                "firstName": "John",
                "lastName":"Doe",
                "birthDate": "1980-10-24",
                ...
            }
            ...
        ],
        ...
    }
    
  • 用于检索具有“email”类型和标签“sport”的服务资源的示例GET请求。

    code language-none
    -X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/service/byChannel/byText?channel=email&text=sport \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    对请求的响应。

    code language-none
    {
        "content": [
            {
                "PKey": "<PKEY>",
                "created": "2019-09-26 09:36:01.014Z",
                "href": "https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/service/<PKEY>",
                "label": "sport",
                "lastModified": "2019-09-26 09:36:01.014Z",
                "limitedDuration": false,
                "messageType": "email",
                "mode": "newsletter",
                "name": "SVC13",
                ...
            }
        ],
        ...
    }
    

自定义过滤器

如果要使用自定义筛选器,则必须在Adobe Campaign Standard界面中创建和自定义该筛选器。 之后,自定义筛选器的行为将与现成筛选器相同:

GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServicesExt/<resourceName>/by<customFilterName>?<customFilterparam>=<customFilterValue>

有关更多信息,请参阅Campaign Standard文档:

示例请求

用于检索交易额为100$或更大的“用户档案”资源的示例GET请求。 请注意,“byAmount”过滤器首先是在Adobe Campaign Standard界面中定义,并链接到“Transaction”自定义表。

-X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServicesExt/profile/byAmount?amount_parameter=100 \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Cache-Control: no-cache' \
-H 'X-Api-Key: <API_KEY>'
recommendation-more-help
7167b251-0f24-48cd-a4e0-234fe2acbdea