数据治理策略端点
数据治理策略是描述允许或限制您对以下范围内的数据执行的营销操作类型的规则 Experience Platform. 此 /policies
中的端点 Policy Service API 允许您以编程方式管理组织的数据治理策略。
/policies
的端点指南 访问控制API 有关如何以编程方式管理访问控制策略的详细信息。快速入门
本指南中使用的API端点是 Policy Service API. 在继续之前,请查看 快速入门指南 有关相关文档的链接、阅读本文档中的示例API调用的指南,以及有关成功调用任何组件所需的所需标头的重要信息 Experience Platform API。
检索策略列表 list
您可以列出所有 core
或 custom
向以下机构发出GET请求 /policies/core
或 /policies/custom
、ID名称和ID名称等。
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"
}
]
}
_page.count
name
status
marketingActionRefs
description
deny
查找策略 look-up
您可以通过包含特定策略的 id
属性添加到GET请求的路径中。
API格式
GET /policies/core/{POLICY_ID}
GET /policies/custom/{POLICY_ID}
{POLICY_ID}
id
要查找的策略的URL。请求
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"
}
name
status
marketingActionRefs
description
deny
创建自定义策略 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
:如果以下内容中的任何标签,则表达式解析为trueoperands
数组存在。AND
:仅当所有标签都位于以下条件时,表达式才会解析为trueoperands
数组存在。
operands
operator
和 operands
属性。 标签和/或操作在 operands
数组根据其同级的值解析为true或false operator
属性。label
您可以通过向以下对象发出POST请求来创建新的自定义策略 /policies/custom
端点。
API格式
POST /policies/custom
请求
以下请求将创建一个限制营销操作的新策略 exportToThirdParty
从对包含标签的数据执行 C1 OR (C3 AND C7)
.
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
在的响应中 查找营销操作.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
要更新的策略的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
在的响应中 查找营销操作.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
您可以通过包含某个自定义策略的 id
在DELETE请求的路径中。
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
默认情况下,只有启用的数据治理策略才参与评估。 您可以向以下网站发出GET请求,以检索贵组织当前启用的核心策略的列表: /enabledCorePolicies
端点。
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
默认情况下,只有启用的数据治理策略才参与评估。 向发出PUT请求 /enabledCorePolicies
端点,您可以通过单个调用更新组织中启用的核心策略的列表。
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用于针对特定标签或数据集测试营销操作,并查看您的策略是否按预期引发违规。 请参阅 策略评估端点 以了解更多信息。