使用,為客戶成功來源建立資料流 Flow Service API
本教學課程涵蓋從客戶成功來源擷取資料,以及使用將資料引進Platform的步驟 Flow Service API.
- 為了建立資料流,您必須擁有具有客戶成功來源的有效基本連線ID。 如果您沒有此ID,請參閱 來源概觀 以取得您可以用來建立基礎連線的客戶成功來源清單。
- 為了讓Experience Platform擷取資料,所有以表格為基礎的批次來源的時區都必須設定為UTC。
快速入門
本教學課程需要您實際瞭解下列Adobe Experience Platform元件:
-
Experience Data Model (XDM) System:Experience Platform組織客戶體驗資料的標準化架構。
- 結構描述組合基本概念:瞭解XDM結構描述的基本建置區塊,包括結構描述組合中的關鍵原則和最佳實務。
- Schema Registry開發人員指南:包含您需瞭解的重要資訊,才能成功執行對Schema Registry API的呼叫。 這包括您的
{TENANT_ID}
、「容器」的概念,以及發出請求所需的標頭(請特別注意Accept標頭及其可能的值)。
-
Catalog Service:目錄是內資料位置和譜系的記錄系統 Experience Platform.
-
Batch ingestion:批次擷取API可讓您將資料擷取到 Experience Platform 作為批次檔案。
-
沙箱: Experience Platform 提供分割單一區域的虛擬沙箱 Platform 將執行個體整合至個別的虛擬環境中,協助開發及改進數位體驗應用程式。
使用平台API
如需如何成功呼叫Platform API的詳細資訊,請參閱以下指南: Platform API快速入門.
建立來源連線 source
您可以透過向以下發出POST請求來建立來源連線: Flow Service API。 來源連線由連線ID、來源資料檔案的路徑以及連線規格ID組成。
若要建立來源連線,您也必須定義資料格式屬性的列舉值。
對檔案型聯結器使用下列列舉值:
delimited
json
parquet
對於所有表式聯結器,設定值 tabular
.
API格式
POST /sourceConnections
要求
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": "Source connection for Customer Success",
"baseConnectionId": "f1da3694-38a9-403d-9a36-9438a9203d42",
"description": "Source connection for a Customer Success connector",
"data": {
"format": "tabular",
},
"params": {
"tableName": "Account",
"columns": [
{
"name": "Id",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Name",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Phone",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "CreatedDate",
"type": "string",
"meta:xdmType": "date-time",
"xdm": {
"type": "string",
"format": "date-time"
}
}
]
},
"connectionSpec": {
"id": "cb66ab34-8619-49cb-96d1-39b37ede86ea",
"version": "1.0"
}
}'
baseConnectionId
params.path
connectionSpec.id
回應
成功的回應會傳回唯一識別碼(id
)。 在後續步驟中,建立目標連線時需要此ID。
{
"id": "17faf955-2cf8-4b15-baf9-552cf88b1540",
"etag": "\"2900a761-0000-0200-0000-5ed18cea0000\""
}
建立目標XDM結構描述 target-schema
為了在Platform中使用來源資料,必須建立目標結構描述,以根據您的需求來建構來源資料。 然後目標結構描述會用來建立包含來源資料的Platform資料集。
您可以透過對以下對象執行POST請求來建立目標XDM結構描述: 結構描述登入API.
如需如何建立目標XDM結構的詳細步驟,請參閱以下教學課程: 使用API建立結構描述.
建立目標資料集 target-dataset
您可以透過對執行POST請求來建立目標資料集 目錄服務API,在裝載中提供目標結構描述的ID。
如需如何建立目標資料集的詳細步驟,請參閱教學課程,位於 使用API建立資料集.
建立目標連線 target-connection
目標連線代表與擷取資料著陸目的地之間的連線。 若要建立目標連線,您必須提供與Data Lake相關聯的固定連線規格ID。 此連線規格ID為: c604ff05-7f1a-43c0-8e18-33bf874cb11c
.
您現在具有目標結構描述、目標資料集和到資料湖的連線規格ID的唯一識別碼。 使用 Flow Service API後,您可以指定這些識別碼,並將包含傳入來源資料的資料集,藉此建立目標連線。
API格式
POST /targetConnections
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": "Target Connection for a customer success connector",
"description": "Target Connection for a customer success connector",
"data": {
"format": "parquet_xdm",
"schema": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/deb3e1096c35d8311b5d80868c4bd5b3cdfd4b3150e7345f",
"version": "application/vnd.adobe.xed-full+json;version=1"
}
},
"params": {
"dataSetId": "5e543e8a60b15218ad44b95f"
},
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
}
}'
data.schema.id
$id
目標XDM結構描述的。data.schema.version
application/vnd.adobe.xed-full+json;version=1
,會傳回結構描述的最新次要版本。params.dataSetId
connectionSpec.id
c604ff05-7f1a-43c0-8e18-33bf874cb11c
.回應
成功回應會傳回新目標連線的唯一識別碼(id
)。 在後續步驟中需要此值,才能建立資料流。
{
"id": "1f5af99c-f1ef-4076-9af9-9cf1ef507678",
"etag": "\"530013e2-0000-0200-0000-5ebc4c110000\""
}
建立對應 mapping
為了將來源資料擷取到目標資料集中,必須首先將其對應到目標資料集所堅持的目標結構描述。
若要建立對應集,請向以下發出POST請求: mappingSets
的端點 Data Prep API 提供您的目標XDM結構描述時 $id
以及要建立的對應集詳細資訊。
API格式
POST /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/b750bd161fef405bc324d0c8809b02c494d73e60e7ae9b3e",
"xdmVersion": "1.0",
"id": null,
"mappings": [
{
"destinationXdmPath": "_id",
"sourceAttribute": "Id",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "person.name.fullName",
"sourceAttribute": "Name",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "_repo.createDate",
"sourceAttribute": "CreatedDate",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
}
]
}'
xdmSchema
$id
目標XDM結構描述的。回應
成功的回應會傳回新建立的對應詳細資訊,包括其唯一識別碼(id
)。 在後續步驟中需要此ID才能建立資料流。
{
"id": "7c3547d3cfc14f568a51c32b4c0ed739",
"version": 0,
"createdDate": 1590792069173,
"modifiedDate": 1590792069173,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
擷取資料流規格 specs
資料流負責從來源收集資料,並將這些資料匯入Platform。 若要建立資料流,您必須先透過對流程服務API執行GET要求來取得資料流規格。 資料流規格負責從協力廠商客戶成功系統收集資料。
API格式
GET /flowSpecs?property=name=="CRMToAEP"
要求
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/flowSpecs?property=name=="CRMToAEP"' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
回應
成功的回應會傳回負責將資料從來源帶入Platform的資料流規格的詳細資料。 回應包含唯一的流量規格 id
建立新資料流時需要。
code language-json |
---|
|
flowSpec.id
sourceConnectionIds
targetConnectionIds
transformations.params.mappingId
transformations.params.deltaColum
deltaColumn
是 yyyy-MM-dd HH:mm:ss
.transformations.params.mappingId
scheduleParams.startTime
scheduleParams.frequency
once
, minute
, hour
, day
,或 week
.scheduleParams.interval
once
且應大於或等於 15
其他頻率值。回應
成功的回應會傳回ID id
建立資料流的URL名稱。
{
"id": "e0bd8463-0913-4ca1-bd84-6309134ca1f6",
"etag": "\"04004fe9-0000-0200-0000-5ebc4c8b0000\""
}
監視資料流
建立資料流後,您可以監視透過該資料流擷取的資料,以檢視有關資料流執行、完成狀態和錯誤的資訊。 如需如何監視資料流的詳細資訊,請參閱以下教學課程: 監視API中的資料流
後續步驟
依照本教學課程所述,您已建立來源聯結器,以依排程從客戶成功系統收集資料。 下游現在可以使用傳入的資料 Platform 服務,例如 Real-Time Customer Profile 和 Data Science Workspace. 如需更多詳細資訊,請參閱下列檔案:
附錄
下節列出不同的雲端儲存空間來源聯結器及其連線規格。
連線規格
cb66ab34-8619-49cb-96d1-39b37ede86ea
eb13cb25-47ab-407f-ba89-c0125281c563