使用強制執行資料使用原則 Policy Service API
一旦您建立了資料的資料使用標籤,並針對這些標籤建立了行銷動作的使用原則,您就可以使用 Policy Service API 評估在資料集或任意一組標籤上執行的行銷動作是否構成原則違規。 然後,您可以設定自己的內部通訊協定,以根據API回應處理原則違規。
ENABLED
可以參與評估。 允許 DRAFT
要參與評估的原則,您必須包括查詢引數 includeDraft=true
在請求路徑中。本檔案提供如何使用 Policy Service API可檢查不同情境中的原則違規。
快速入門
本教學課程需要您深入瞭解下列實施資料使用原則的重要概念:
在開始本教學課程之前,請檢閱 開發人員指南 如需您成功對 Policy Service API,包括必要的標頭以及如何讀取範例API呼叫。
使用標籤和行銷動作進行評估
您可以根據一組假設會出現在資料集中的資料使用標籤來測試行銷動作,以評估原則。 這是透過使用 duleLabels
查詢引數,其中標籤是以逗號分隔的值清單提供,如以下範例所示。
API格式
GET /marketingActions/core/{MARKETING_ACTION_NAME}/constraints?duleLabels={LABEL_1},{LABEL_2}
GET /marketingActions/custom/{MARKETING_ACTION_NAME}/constraints?duleLabels={LABEL_1},{LABEL_2}
{MARKETING_ACTION_NAME}
{LABEL_1}
要求
以下請求會測試 exportToThirdParty
針對標籤的行銷動作 C1
和 C3
. 由於您先前在本教學課程中建立的資料使用原則會定義 C1
標籤為其中一項 deny
條件的原則運算式中,行銷動作應觸發原則違規。
C1
標籤會觸發違規,而 c1
標籤不會。curl -X GET \
https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty/constraints?duleLabels=C1,C3 \
-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}'
回應
成功回應會傳回行銷動作的URL、測試該動作時所用的使用標籤,以及針對這些標籤測試該動作所違反的任何原則清單。 在此範例中,「將資料匯出至第三方」原則顯示在 violatedPolicies
陣列,指出行銷動作觸發了預期的原則違規。
{
"timestamp": 1565727821209,
"clientId": "string",
"userId": "string",
"imsOrg": "{ORG_ID}",
"marketingActionRef": "https://platform-stage.adobe.io:443/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty",
"duleLabels": [
"C1",
"C3"
],
"violatedPolicies": [
{
"name": "Export Data to Third Party",
"status": "ENABLED",
"marketingActionRefs": [
"https://platform-stage.adobe.io:443/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": 1565651746693,
"createdClient": "{CREATED_CLIENT}",
"createdUser": "{CREATED_USER",
"updated": 1565723012139,
"updatedClient": "{UPDATED_CLIENT}",
"updatedUser": "{UPDATED_USER}",
"_links": {
"self": {
"href": "https://platform-stage.adobe.io/data/foundation/dulepolicy/policies/custom/5d51f322e553c814e67af1a3"
}
},
"id": "5d51f322e553c814e67af1a3"
}
]
}
violatedPolicies
marketingActionRef
)與提供的 duleLabels
.使用資料集進行評估
您可以針對可收集標籤的一或多個資料集測試行銷動作,以評估資料使用原則。 這可透過向發出POST請求來完成 /marketingActions/core/{MARKETING_ACTION_NAME}/constraints
並在請求內文中提供資料集ID,如下列範例所示。
API格式
POST /marketingActions/core/{MARKETING_ACTION_NAME}/constraints
POST /marketingActions/custom/{MARKETING_ACTION_NAME}/constraints
{MARKETING_ACTION_NAME}
要求
以下請求會測試 exportToThirdParty
針對三個不同資料集執行行銷動作。 資料集由承載中提供的陣列中的型別和ID引用。
curl -X POST \
https://platform.adobe.io/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty/constraints
-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}' \
-H 'Content-Type: application/json' \
-d '[
{
"entityType": "dataSet",
"entityId": "5c423dc25f2f2e00005e2319"
},
{
"entityType": "dataSet",
"entityId": "5cc323e15410ef14b749481e"
},
{
"entityType": "dataSet",
"entityId": "5cc1fb685410ef14b748c55f",
"entityMeta": {
"fields": [
"/properties/personalEmail/properties/address",
"/properties/person/properties/name/properties/fullName"
]
}
}
]'
entityType
entityId
entityMeta.fields
如果未包含此欄位,則資料集結構描述中的所有欄位都將包含在評估中。
回應
成功的回應會傳回行銷動作的URL、從提供的資料集收集的使用情況標籤,以及針對這些標籤測試動作所違反的任何原則清單。 在此範例中,「將資料匯出至第三方」原則顯示在 violatedPolicies
陣列,指出行銷動作觸發了預期的原則違規。
{
"timestamp": 1556324277895,
"clientId": "{CLIENT_ID}",
"userId": "{USER_ID}",
"imsOrg": "{ORG_ID}",
"marketingActionRef": "https://platform.adobe.io:443/data/foundation/dulepolicy/marketingActions/custom/exportToThirdParty",
"duleLabels": [
"C1",
"C2",
"C4",
"C5",
"C6"
],
"discoveredLabels": [
{
"entityType": "dataSet",
"entityId": "5c423dc25f2f2e00005e2319",
"dataSetLabels": {
"connection": {
"labels": []
},
"dataSet": {
"labels": [
"C6"
]
},
"fields": [
{
"labels": [
"C2",
"C5"
],
"path": "/properties/_customer"
},
{
"labels": [
"C4",
"C5"
],
"path": "/properties/geoUnit"
},
{
"labels": [
"C4"
],
"path": "/properties/identityMap"
},
{
"labels": [
"C4"
],
"path": "/properties/journeyAI"
},
{
"labels": [
"C5"
],
"path": "/properties/createdByBatchID"
},
{
"labels": [
"C5"
],
"path": "/properties/faxPhone"
}
]
}
},
{
"entityType": "dataSet",
"entityId": "5cc323e15410ef14b749481e",
"dataSetLabels": {
"connection": {
"labels": []
},
"dataSet": {
"labels": [
"C5"
]
},
"fields": [
{
"labels": [
"C2",
],
"path": "/properties/_customer"
},
{
"labels": [
"C5"
],
"path": "/properties/geoUnit"
},
{
"labels": [
"C1"
],
"path": "/properties/identityMap"
}
]
}
},
{
"entityType": "dataSet",
"entityId": "5cc1fb685410ef14b748c55f",
"dataSetLabels": {
"connection": {
"labels": []
},
"dataSet": {
"labels": [
"C5"
]
},
"fields": [
{
"labels": [
"C5"
],
"path": "/properties/personalEmail/properties/address",
},
{
"labels": [
"C5"
],
"path": "/properties/person/properties/name/properties/fullName"
}
]
}
}
],
"violatedPolicies": [
{
"name": "Export Data to Third Party",
"status": "ENABLED",
"marketingActionRefs": [
"https://platform-stage.adobe.io:443/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": 1565651746693,
"createdClient": "{CREATED_CLIENT}",
"createdUser": "{CREATED_USER",
"updated": 1565723012139,
"updatedClient": "{UPDATED_CLIENT}",
"updatedUser": "{UPDATED_USER}",
"_links": {
"self": {
"href": "https://platform-stage.adobe.io/data/foundation/dulepolicy/policies/custom/5d51f322e553c814e67af1a3"
}
},
"id": "5d51f322e553c814e67af1a3"
}
]
}
duleLabels
discoveredLabels
violatedPolicies
marketingActionRef
)與提供的 duleLabels
.後續步驟
透過閱讀本檔案,您在對資料集或一組資料使用標籤執行行銷動作時,已成功檢查原則違規。 您可以使用API回應中傳回的資料,在體驗應用程式中設定通訊協定,以便在發生原則違規時適當地強制執行。
如需Platform如何自動為已啟用的區段提供原則執行的資訊,請參閱以下指南: 自動執行.