使用OneTrust Integration API為Flow Service來源建立資料流
下列教學課程會逐步引導您完成建立來源連線和資料流的步驟,以使用OneTrust IntegrationAPI將歷史資料和排程同意資料從Flow Service 帶入Adobe Experience Platform。
先決條件
您必須先擷取存取權杖,才能將OneTrust Integration連線至Experience Platform。 如需尋找存取Token的詳細指示,請參閱OneTrust Integration OAuth 2指南。
存取權杖到期後不會自動重新整理,因為OneTrust不支援系統間重新整理權杖。 因此,在連線過期之前,必須確定您的存取權杖已在連線中更新。 存取權杖的最大可設定存留期為一年。 若要深入瞭解如何更新您的存取權杖,請參閱有關管理您的OAuth 2.0使用者端認證OneTrust 的檔案。
使用OneTrust Integration API連線Flow Service至Experience Platform
下列教學課程將逐步引導您完成建立OneTrust Integration來源連線與建立資料流的步驟,以使用OneTrust IntegrationAPIFlow Service 將資料帶入Experience Platform。
建立基礎連線 base-connection
基本連線會保留來源與Experience Platform之間的資訊,包括來源的驗證認證、連線的目前狀態,以及唯一的基本連線ID。 基礎連線ID可讓您從來源內部探索及導覽檔案,並識別您要擷取的特定專案,包括其資料型別和格式的資訊。
若要建立基底連線ID,請在提供您的/connections驗證認證作為要求內文的一部分時,對OneTrust Integration端點提出POST要求。
API格式
POST /connections
要求
下列要求會建立OneTrust Integration的基礎連線:
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/connections' \
-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 '{
"name": "ONETRUST base connection",
"description": "ONETRUST base connection to authenticate to Experience Platform",
"connectionSpec": {
"id": "cf16d886-c627-4872-9936-fb08d6cba8cc",
"version": "1.0"
},
"auth": {
"specName": "OAuth2 Refresh Code",
"params": {
"accessToken": "{ACCESS_TOKEN}"
}
}
}'
namedescriptionconnectionSpec.idauth.specNameauth.params.auth.params.accessToken回應
成功的回應會傳回新建立的基礎連線,包括其唯一的連線識別碼(id)。 在下一步中探索來源的檔案結構和內容時,需要此ID。
{
"id": "622124ca-6d18-47f7-999c-66f599955309",
"etag": "\"2e026443-0000-0200-0000-621f1af80000\""
}
探索您的來源 explore
使用您在上一步中產生的基本連線ID,您可以執行GET要求來探索檔案和目錄。
使用以下呼叫來尋找您要帶入Experience Platform的檔案路徑:
API格式
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=rest&object={OBJECT}&fileType={FILE_TYPE}&preview={PREVIEW}
執行GET請求以探索來源的檔案結構和內容時,您必須包含下表列出的查詢引數:
{BASE_CONNECTION_ID}objectType=restrest。{OBJECT}fileType=jsonjson是唯一受支援的檔案型別。{PREVIEW}要求
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/connections/622124ca-6d18-47f7-999c-66f599955309/explore?objectType=rest&object=json&fileType=json&preview=true' \
-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}'
回應
成功的回應會傳回查詢檔案的結構。
| code language-json |
|---|
|
建立來源連線 source-connection
您可以對Flow Service API發出POST要求,以建立來源連線。 來源連線由連線ID、來源資料檔案的路徑以及連線規格ID組成。
API格式
POST /sourceConnections
要求
下列要求會建立OneTrust Integration的來源連線:
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/sourceConnections' \
-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 '{
"name": "ONETRUST Source Connection",
"description": "ONETRUST Source Connection",
"baseConnectionId": "622124ca-6d18-47f7-999c-66f599955309",
"connectionSpec": {
"id": "cf16d886-c627-4872-9936-fb08d6cba8cc",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {}
}'
namedescriptionbaseConnectionIdconnectionSpec.iddata.formatjson。回應
成功的回應會傳回新建立的來源連線的唯一識別碼(id)。 在後續步驟中需要此ID才能建立資料流。
{
"id": "eb5833d3-230d-4700-80cc-bda396e7af8a",
"etag": "\"da04c07f-0000-0200-0000-621f1afc0000\""
}
建立目標XDM結構描述 target-schema
為了在Experience Platform中使用來源資料,必須建立目標結構描述,以根據您的需求建構來源資料。 然後使用目標結構描述來建立包含來源資料的Experience Platform資料集。
可透過對結構描述登入API執行POST要求來建立目標XDM結構描述。
如需有關如何建立目標XDM結構描述的詳細步驟,請參閱有關使用API 建立結構描述的教學課程。
建立目標資料集 target-dataset
可透過對目錄服務API執行POST要求,在承載中提供目標結構描述的ID,來建立目標資料集。
如需有關如何建立目標資料集的詳細步驟,請參閱有關使用API建立資料集的教學課程。
建立目標連線 target-connection
目標連線代表與要儲存所擷取資料的目的地之間的連線。 若要建立目標連線,您必須提供對應至Data Lake的固定連線規格識別碼。 此ID為: c604ff05-7f1a-43c0-8e18-33bf874cb11c。
您現在擁有目標結構描述、目標資料集和與Data Lake的連線規格ID的唯一識別碼。 使用這些識別碼,您可以使用Flow Service API建立目標連線,以指定將包含傳入來源資料的資料集。
API格式
POST /targetConnections
要求
下列要求會建立OneTrust Integration的目標連線:
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/targetConnections' \
-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 '{
"name": "ONETRUST Target Connection",
"description": "ONETRUST Target Connection",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
"dataSetId": "61f6ca3f33978c19486bb463"
}
}'
namedescriptionconnectionSpec.idc604ff05-7f1a-43c0-8e18-33bf874cb11c。data.formatparams.dataSetId回應
成功的回應會傳回新目標連線的唯一識別碼(id)。 此ID在後續步驟中是必要的。
{
"id": "495f761f-310a-4a7b-ae78-5b1152d74b38",
"etag": "\"410a7b0c-0000-0200-0000-621f1afd0000\""
}
建立對應 mapping
為了將來源資料擷取到目標資料集中,必須首先將其對應到目標資料集所堅持的目標結構描述。 這是透過使用在要求裝載中定義的資料對應對Data Prep API執行POST要求來達成。
API格式
POST /conversion/mappingSets
要求
curl -X POST \
'https://platform.adobe.io/data/foundation/conversion/mappingSets' \
-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 '{
"version": 0,
"xdmSchema": "https://ns.adobe.com/{TENANT_ID}/schemas/cfc8cee182e546c1fb35071185524b465e06bf1acb74f30d",
"xdmVersion": "1.0",
"id": null,
"mappings": [{
"sourceType": "ATTRIBUTE",
"source": "content.Identifier",
"destination": "_id",
"name": "id",
"description": "Identifier field"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.Identifier",
"destination": "_exchangesandboxbravo.Identifier"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.Language",
"destination": "_exchangesandboxbravo.Language",
"description": "Language field"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.CreatedDate",
"destination": "_exchangesandboxbravo.CreatedDate",
"description": "Created Date field"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.LastUpdatedDate",
"destination": "_exchangesandboxbravo.LastUpdatedDate",
"description": "Created Date field"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.DataElements",
"destination": "_exchangesandboxbravo.DataElements"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.Purposes",
"destination": "_exchangesandboxbravo.Purposes"
},
{
"sourceType": "ATTRIBUTE",
"source": "content.LinkToken",
"destination": "_exchangesandboxbravo.LinkToken",
"description": "Link Token"
}
]
}'
xdmSchemamappings.destinationXdmPathmappings.sourceAttribute回應
成功的回應會傳回新建立的對應詳細資料,包括其唯一識別碼(id)。 在後續步驟中需要此值,才能建立資料流。
{
"id": "a87f130e82f04d5188da01f087805c4b",
"version": 0,
"createdDate": 1646205694395,
"modifiedDate": 1646205694395,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
建立流程 flow
將資料從OneTrust Integration引進Experience Platform的最後一步是建立資料流。 到現在為止,您已準備下列必要值:
資料流負責從來源排程及收集資料。 您可以執行POST要求,同時在裝載中提供先前提及的值來建立資料流。
若要排程內嵌,您必須先將開始時間值設為以秒為單位的epoch時間。 然後,您必須將頻率值設定為下列五個選項之一: once、minute、hour、day或week。 間隔值會指定兩個連續擷取之間的期間,不過,建立一次性擷取不需要設定間隔。 對於所有其他頻率,間隔值必須設定為等於或大於15。
API格式
POST /flows
要求
curl -X POST \
'https://platform.adobe.io/data/foundation/flowservice/flows' \
-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 '{
"name": "ONETRUST dataflow",
"description": "ONETRUST dataflow",
"flowSpec": {
"id": "6499120c-0b15-42dc-936e-847ea3c24d72",
"version": "1.0"
},
"sourceConnectionIds": [
"eb5833d3-230d-4700-80cc-bda396e7af8a"
],
"targetConnectionIds": [
"495f761f-310a-4a7b-ae78-5b1152d74b38"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "a87f130e82f04d5188da01f087805c4b",
"mappingVersion": 0
}
}
],
"scheduleParams": {
"startTime": "1625040887",
"frequency": "minute",
"interval": 15
}
}'
namedescriptionflowSpec.id6499120c-0b15-42dc-936e-847ea3c24d72。flowSpec.version1.0。sourceConnectionIdstargetConnectionIdstransformationstransformations.nametransformations.params.mappingIdtransformations.params.mappingVersion0。scheduleParams.startTimescheduleParams.frequencyonce、minute、hour、day或week。scheduleParams.intervalonce時不需要間隔,其他頻率值應該大於或等於15。回應
成功的回應會傳回新建立的資料流識別碼(id)。 您可以使用此ID來監視、更新或刪除資料流。
{
"id": "70045189-42f0-493d-9b9e-be1045a9f4fa",
"etag": "\"1601e900-0000-0200-0000-621f1b080000\""
}
附錄
下節提供監視、更新和刪除資料流的步驟相關資訊。
監視資料流
建立資料流後,您可以監視透過該資料流擷取的資料,以檢視有關資料流執行、完成狀態和錯誤的資訊。 如需完整的API範例,請閱讀使用API監視您的來源資料流的指南。
更新您的資料流
提供資料流的ID時,透過向/flows API的Flow Service端點發出PATCH要求,更新資料流的詳細資訊,例如其名稱和說明,以及其執行排程和相關聯的對應集。 發出PATCH請求時,您必須在etag標頭中提供資料流的唯一If-Match。 如需完整的API範例,請閱讀使用API更新來源資料流的指南。
更新您的帳戶
在提供您的基本連線ID作為查詢引數的同時,透過對Flow Service API執行PATCH請求來更新來源帳戶的名稱、說明和認證。 發出PATCH請求時,您必須在etag標頭中提供來源帳戶的唯一If-Match。 如需完整的API範例,請閱讀使用API更新來源帳戶的指南。
刪除您的資料流
提供您要刪除之資料流的ID做為查詢引數的一部分,同時對Flow Service API執行DELETE要求,以刪除您的資料流。 如需完整的API範例,請閱讀使用API刪除資料流的指南。
刪除您的帳戶
在提供您要刪除之帳戶的基本連線ID時,對Flow Service API執行DELETE要求,以刪除您的帳戶。 如需完整的API範例,請閱讀使用API刪除來源帳戶的指南。