数据治理策略端点
数据治理策略是描述允许或限制您对Experience Platform内的数据执行的营销操作类型的规则。 Policy Service API中的/policies
端点允许您以编程方式管理组织的数据治理策略。
/policies
端点指南。快速入门
本指南中使用的API端点是Policy Service API的一部分。 在继续之前,请查看快速入门指南,以获取相关文档的链接、此文档中示例API调用的阅读指南,以及有关成功调用任何Experience Platform API所需的所需标头的重要信息。
检索策略列表 list
通过分别向/policies/core
或/policies/custom
发出GET请求,可列出所有core
或custom
策略。
API格式
GET /policies/core
GET /policies/custom
请求
以下请求将检索由您的组织定义的自定义策略列表。
curl -X GET \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
响应
成功的响应包括一个children
数组,该数组列出了每个检索到的策略的详细信息,包括其id
值。 您可以使用特定策略的id
字段为该策略执行查找、更新和删除请求。
{
"_page": {
"start": "5c6dacdf685a4913dc48937c",
"count": 2
},
"_links": {
"page": {
"href": "https://platform.adobe.io/policies/custom?{?limit,start,property}",
"templated": true
}
},
"children": [
{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "AND",
"operands": [
{
"label": "C1"
},
{
"operator": "OR",
"operands": [
{
"label": "C3"
},
{
"label": "C7"
}
]
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550691551888,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550701472910,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c"
}
},
"id": "5c6dacdf685a4913dc48937c"
},
{
"name": "Combine Data",
"status": "ENABLED",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/combineData"
],
"description": "Data that meets these conditions cannot be combined.",
"deny": {
"operator": "AND",
"operands": [
{
"label": "C3"
},
{
"label": "I1"
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550703519823,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550714340335,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6ddb9f5c404513dc2dc454"
}
},
"id": "5c6ddb9f5c404513dc2dc454"
}
]
}
查找策略 look-up
通过在GET请求的路径中包含特定策略的id
属性,您可以查找该策略。
API格式
GET /policies/core/{POLICY_ID}
GET /policies/custom/{POLICY_ID}
{POLICY_ID}
id
。请求
curl -X GET \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
响应
成功的响应将返回策略的详细信息。
{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "AND",
"operands": [
{
"label": "C1"
},
{
"operator": "OR",
"operands": [
{
"label": "C3"
},
{
"label": "C7"
}
]
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550703519823,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550714340335,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c"
}
},
"id": "5c6dacdf685a4913dc48937c"
}
创建自定义策略 create-policy
在Policy Service API中,策略由以下内容定义:
- 对特定营销活动的引用
- 描述营销操作被限制无法执行的数据使用标签的表达式
为了满足后一要求,策略定义必须包括关于数据使用标签存在的布尔表达式。 此表达式称为策略表达式。
策略表达式在每个策略定义中以deny
属性的形式提供。 仅检查单个标签存在的简单deny
对象的示例如下所示:
"deny": {
"label": "C1"
}
但是,许多策略会指定有关数据使用标签存在的更复杂条件。 要支持这些用例,您还可以包含布尔操作来描述策略表达式。 策略表达式对象必须包含标签或运算符和操作数,但不能同时包含两者。 反过来,每个操作数也是策略表达式对象。
例如,为了定义禁止对存在C1 OR (C3 AND C7)
标签的数据执行营销操作的策略,策略的deny
属性将指定为:
"deny": {
"operator": "OR",
"operands": [
{"label": "C1"},
{
"operator": "AND",
"operands": [
{"label": "C3"},
{"label": "C7"}
]
}
]
}
operator
指示在同级operands
数组中提供的标签之间的条件关系。 接受的值包括:
OR
:如果operands
数组中的任何标签存在,则表达式解析为true。AND
:仅当operands
数组中的所有标签都存在时,表达式才会解析为true。
operands
operator
和operands
属性的附加对。 operands
数组中标签和/或操作的存在根据其同级operator
属性的值解析为true或false。label
您可以通过向/policies/custom
端点发出POST请求来创建新的自定义策略。
API格式
POST /policies/custom
请求
以下请求创建一个新策略,该策略限制对包含标签C1 OR (C3 AND C7)
的数据执行营销操作exportToThirdParty
。
curl -X POST \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "OR",
"operands": [
{"label": "C1"},
{
"operator": "AND",
"operands": [
{"label": "C3"},
{"label": "C7"}
]
}
]
}
}'
name
status
marketingActionRefs
_links.self.href
下提供了营销操作的URI。description
deny
响应
成功的响应返回新创建的策略的详细信息,包括其id
。 此值是只读的,在创建策略时自动分配。
{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "OR",
"operands": [
{
"label": "C1"
},
{
"operator": "AND",
"operands": [
{
"label": "C3"
},
{
"label": "C7"
}
]
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550691551888,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550691551888,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c"
}
},
"id": "5c6dacdf685a4913dc48937c"
}
更新自定义策略 update
您可以更新现有的自定义策略,方法是:在PUT请求的路径中提供其ID,有效负载中包含完整的已更新策略形式。 换句话说,PUT请求实际上重写了策略。
API格式
PUT /policies/custom/{POLICY_ID}
{POLICY_ID}
id
。请求
在此示例中,将数据导出到第三方的条件已更改,现在,如果存在C1 AND C5
数据标签,您需要创建的策略来拒绝此营销操作。
以下请求更新现有策略以包含新的策略表达式。 请注意,由于此请求实际上会重写策略,因此有效负载中必须包括所有字段,即使它们的某些值未更新也是如此。
curl -X PUT \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"../marketingActions/custom/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "AND",
"operands": [
{"label": "C1"},
{"label": "C5"}
]
}
}'
name
status
marketingActionRefs
_links.self.href
下提供了营销操作的URI。description
deny
响应
成功的响应将返回更新策略的详细信息。
{
"name": "Export Data to Third Party",
"status": "DRAFT",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/core/exportToThirdParty"
],
"description": "Conditions under which data cannot be exported to a third party",
"deny": {
"operator": "AND",
"operands": [
{
"label": "C1"
},
{
"label": "C5"
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550691551888,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550701472910,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c"
}
},
"id": "5c6dacdf685a4913dc48937c"
}
更新自定义策略的一部分 patch
可以使用PATCH请求更新策略的特定部分。 与重写策略的PUT请求不同,PATCH请求仅更新请求正文中指定的属性。 当您要启用或禁用策略时,此功能特别有用,因为您只需提供相应属性(/status
)及其值(ENABLED
或DISABLED
)的路径。
Policy Service API支持JSON修补程序操作add
、remove
和replace
,并允许您将多个更新组合到单个调用中,如以下示例所示。
API格式
PATCH /policies/custom/{POLICY_ID}
{POLICY_ID}
id
。请求
以下请求使用两个replace
操作将策略状态从DRAFT
更改为ENABLED
,并使用新描述更新description
字段。
curl -X PATCH \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d ' [
{
"op": "replace",
"path": "/status",
"value": "ENABLED"
},
{
"op": "replace",
"path": "/description",
"value": "New policy description."
}
]'
响应
成功的响应将返回更新策略的详细信息。
{
"name": "Export Data to Third Party",
"status": "ENABLED",
"marketingActionRefs": [
"https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty"
],
"description": "New policy description.",
"deny": {
"operator": "AND",
"operands": [
{
"label": "C1"
},
{
"operator": "OR",
"operands": [
{
"label": "C3"
},
{
"label": "C7"
}
]
}
]
},
"imsOrg": "{ORG_ID}",
"created": 1550703519823,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1550712163182,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6dacdf685a4913dc48937c"
}
},
"id": "5c6dacdf685a4913dc48937c"
}
删除自定义策略 delete
通过在DELETE请求的路径中包含自定义策略的id
,可以删除该策略。
API格式
DELETE /policies/custom/{POLICY_ID}
{POLICY_ID}
请求
curl -X DELETE \
https://platform.adobe.io/data/foundation/dulepolicy/policies/custom/5c6ddb56eb60ca13dbf8b9a8 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
响应
成功的响应会返回带有空白正文的HTTP状态200 (确定)。
您可以通过再次尝试查找(GET)策略来确认删除。 如果已成功删除策略,您应会收到HTTP 404 (未找到)错误。
检索已启用的核心策略的列表 list-enabled-core
默认情况下,只有启用的数据治理策略才参与评估。 您可以通过向/enabledCorePolicies
端点发出GET请求,检索贵组织当前启用的核心策略的列表。
API格式
GET /enabledCorePolicies
请求
curl -X GET \
https://platform.adobe.io/data/foundation/dulepolicy/enabledCorePolicies \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
响应
成功的响应返回policyIds
数组下启用的核心策略列表。
{
"policyIds": [
"corepolicy_0001",
"corepolicy_0002",
"corepolicy_0003",
"corepolicy_0004",
"corepolicy_0005",
"corepolicy_0006",
"corepolicy_0007",
"corepolicy_0008"
],
"imsOrg": "{ORG_ID}",
"created": 1529696681413,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1529697651972,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io:443/data/foundation/dulepolicy/enabledCorePolicies"
}
}
}
更新已启用的核心策略的列表 update-enabled-core
默认情况下,只有启用的数据治理策略才参与评估。 通过向/enabledCorePolicies
端点发出PUT请求,您可以使用单个调用更新组织中启用的核心策略的列表。
API格式
PUT /enabledCorePolicies
请求
以下请求根据有效负载中提供的ID更新已启用的核心策略的列表。
curl -X GET \
https://platform.adobe.io/data/foundation/dulepolicy/enabledCorePolicies \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"policyIds": [
"corepolicy_0001",
"corepolicy_0002",
"corepolicy_0007",
"corepolicy_0008"
]
}'
policyIds
DISABLED
状态,将不会参与评估。响应
成功的响应返回policyIds
数组下启用的核心策略的更新列表。
{
"policyIds": [
"corepolicy_0001",
"corepolicy_0002",
"corepolicy_0007",
"corepolicy_0008"
],
"imsOrg": "{ORG_ID}",
"created": 1529696681413,
"createdClient": "{CLIENT_ID}",
"createdUser": "{USER_ID}",
"updated": 1595876052649,
"updatedClient": "{CLIENT_ID}",
"updatedUser": "{USER_ID}",
"_links": {
"self": {
"href": "https://platform.adobe.io:443/data/foundation/dulepolicy/enabledCorePolicies"
}
}
}
后续步骤
定义新策略或更新现有策略后,您可以使用Policy Service API针对特定标签或数据集测试营销操作,并查看策略是否按预期引发违规。 有关详细信息,请参阅策略评估端点指南。