為以下專案建立來源連線和資料流: Customer.io 使用流量服務API
下列教學課程將逐步引導您完成建立 Customer.io 要帶來的來源連線和資料流 Customer.io 使用將事件資料匯入Adobe Experience Platform Flow Service API.
快速入門 getting-started
本指南需要您深入了解下列 Experience Platform 元件:
連線 Customer.io 至平台,使用 Flow Service API connect-platform-to-flow-api
以下概述建立來源連線和資料流所需的步驟,以將 Customer.io 要Experience Platform的事件資料。
建立來源連線 source-connection
透過向發出POST請求來建立來源連線 Flow Service api,同時提供來源的連線規格ID、名稱和說明等詳細資訊,以及資料的格式。
API格式
POST /sourceConnections
要求
以下請求會為建立來源連線 Customer.io:
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": "Streaming Source Connection for Customer.io",
"providerId": "521eee4d-8cbe-4906-bb48-fb6bd4450033",
"description": "Streaming Source Connection for customer.io",
"connectionSpec": {
"id": "96479064-7b8a-4d69-b9ed-21c5683837ea",
"version": "1.0"
},
"data": {
"format": "json"
}
}'
name
description
connectionSpec.id
data.format
json
.回應
成功的回應會傳回唯一識別碼(id
)。 在後續步驟中需要此ID才能建立資料流。
{
"id": "133bb51f-f310-4b4a-b8b2-731aef1e223c",
"etag": "\"af00a717-0000-0200-0000-63ef2cbd0000\""
}
建立目標XDM結構描述 target-schema
為了在Platform中使用來源資料,必須建立目標結構描述,以根據您的需求來建構來源資料。 然後目標結構描述會用來建立包含來源資料的Platform資料集。
您可以透過對以下對象執行POST請求來建立目標XDM結構描述: 結構描述登入API.
如需如何建立目標XDM結構的詳細步驟,請參閱以下教學課程: 使用API建立結構描述.
建立目標資料集 target-dataset
您可以透過對執行POST請求來建立目標資料集 目錄服務API,在裝載中提供目標結構描述的ID。
如需如何建立目標資料集的詳細步驟,請參閱教學課程,位於 使用API建立資料集.
建立目標連線 target-connection
目標連線代表與要儲存所擷取資料的目的地之間的連線。 若要建立目標連線,您必須提供對應至資料湖的固定連線規格ID。 此ID為: c604ff05-7f1a-43c0-8e18-33bf874cb11c
.
您現在具有目標結構描述、目標資料集和到資料湖的連線規格ID的唯一識別碼。 使用這些識別碼,您可以使用以下專案建立目標連線: Flow Service API可指定將包含傳入來源資料的資料集。
API格式
POST /targetConnections
要求
以下請求會為建立目標連線 Customer.io:
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": "Streaming Target Connection for Customer.io",
"description": "Streaming Target Connection for Customer.io",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
},
"data": {
"format": "json",
"schema": {
"id": "https://ns.adobe.com/extconndev/schemas/945546112b746524bfd9f1264b26c2b7d8e7f5b7fadb953a",
"version": "application/vnd.adobe.xed-full+json;version=1"
}
},
"params": {
"dataSetId": "63ec807d3f5ce91bd2d06c65"
}
}'
name
description
connectionSpec.id
c604ff05-7f1a-43c0-8e18-33bf874cb11c
.data.format
params.dataSetId
回應
成功回應會傳回新目標連線的唯一識別碼(id
)。 此ID在後續步驟中是必要的。
{
"id": "da8b75ad-f6ee-4991-95df-291e62936e98",
"etag": "\"70003dff-0000-0200-0000-63ef4a090000\""
}
建立對應 mapping
為了將來源資料擷取到目標資料集中,必須首先將其對應到目標資料集所堅持的目標結構描述。 這是透過向執行POST請求來達成 Data Prep API 要求裝載中定義資料對應。
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 '{
"outputSchema": {
"schemaRef": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/945546112b746524bfd9f1264b26c2b7d8e7f5b7fadb953a",
"contentType": "application/vnd.adobe.xed-full+json;version=1"
}
},
"mappings": [
{
"destinationXdmPath": "_extconndev.cio_id",
"sourceAttribute": "data.identifiers.cio_id",
"identity": false,
"version": 0
},
{
"destinationXdmPath": "_extconndev.email",
"sourceAttribute": "data.identifiers.email",
"identity": false,
"version": 0
},
{
"destinationXdmPath": "_extconndev.event_id0",
"sourceAttribute": "event_id",
"identity": false,
"version": 0
},
{
"destinationXdmPath": "_extconndev.metricx",
"sourceAttribute": "metric",
"identity": false,
"version": 0
},
{
"destinationXdmPath": "_extconndev.object_type1",
"sourceAttribute": "object_type",
"identity": false,
"version": 0
},
{
"destinationXdmPath": "_extconndev.timestampx",
"sourceAttribute": "timestamp",
"identity": false,
"version": 0
}
]
}'
outputSchema.schemaRef.id
mappings.sourceType
mappings.source
mappings.destination
回應
成功的回應會傳回新建立的對應詳細資訊,包括其唯一識別碼(id
)。 在後續步驟中需要此值,才能建立資料流。
{
"id": "59c0e53a2dc84f7791ecc1b3d6e51d5e",
"version": 0,
"createdDate": 1676627988129,
"modifiedDate": 1676627988129,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
建立流程 flow
從匯入資料的最後一步 Customer.io 到Platform就是建立資料流。 到現在為止,您已準備下列必要值:
資料流負責從來源排程及收集資料。 您可以執行POST要求,同時在裝載中提供先前提到的值,藉此建立資料流。
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": "Streaming Dataflow for Customer.io",
"description": "Streaming Dataflow for Customer.io",
"flowSpec": {
"id": "e77fde5a-22a8-11ed-861d-0242ac120002",
"version": "1.0"
},
"sourceConnectionIds": [
"133bb51f-f310-4b4a-b8b2-731aef1e223c"
],
"targetConnectionIds": [
"da8b75ad-f6ee-4991-95df-291e62936e98"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "59c0e53a2dc84f7791ecc1b3d6e51d5e",
"mappingVersion": 0
}
}
]
}'
name
description
flowSpec.id
e77fde5a-22a8-11ed-861d-0242ac120002
.flowSpec.version
1.0
.sourceConnectionIds
targetConnectionIds
transformations
transformations.name
transformations.params.mappingId
transformations.params.mappingVersion
0
.回應
成功的回應會傳回ID (id
)。 您可以使用此ID來監視、更新或刪除資料流。
{
"id": "4982698b-e6b3-48c2-8dcf-040e20121fd2",
"etag": "\"4c012103-0000-0200-0000-63ef57db0000\""
}
取得您的串流端點URL get-streaming-endpoint-url
建立資料流後,您現在可以擷取串流端點URL。 您將使用此端點URL來將您的來源訂閱給webhook,以允許您的來源與Experience Platform通訊。
GET若要擷取您的串流端點URL,請對 /flows
端點並提供資料流的ID。
API格式
GET /flows/{FLOW_ID}
要求
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/flows/4982698b-e6b3-48c2-8dcf-040e20121fd2' \
-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}'
回應
成功的回應會傳回資料流上的資訊,包括標示為 inletUrl
. 請參閱 設定Webhook 頁面以取得所需的值。
{
"items": [
{
"id": "4982698b-e6b3-48c2-8dcf-040e20121fd2",
"createdAt": 1676629979503,
"updatedAt": 1676629985390,
"createdBy": "acme@AdobeID",
"updatedBy": "acme@AdobeID",
"createdClient": "{CREATED_CLIENT}",
"updatedClient": "{UPDATED_CLIENT}",
"sandboxId": "{SANDBOX_ID}",
"sandboxName": "{SANDBOX_NAME}",
"imsOrgId": "{ORG_ID}",
"name": "Streaming Dataflow for Customer.io",
"description": "Streaming Dataflow for Customer.io",
"flowSpec": {
"id": "e77fde5a-22a8-11ed-861d-0242ac120002",
"version": "1.0"
},
"state": "enabled",
"version": "\"4c01c003-0000-0200-0000-63ef57e10000\"",
"etag": "\"4c01c003-0000-0200-0000-63ef57e10000\"",
"sourceConnectionIds": [
"133bb51f-f310-4b4a-b8b2-731aef1e223c"
],
"targetConnectionIds": [
"da8b75ad-f6ee-4991-95df-291e62936e98"
],
"inheritedAttributes": {
"properties": {
"isSourceFlow": true
},
"sourceConnections": [
{
"id": "133bb51f-f310-4b4a-b8b2-731aef1e223c",
"connectionSpec": {
"id": "96479064-7b8a-4d69-b9ed-21c5683837ea",
"version": "1.0"
}
}
],
"targetConnections": [
{
"id": "da8b75ad-f6ee-4991-95df-291e62936e98",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
}
}
]
},
"options": {
"inletUrl": "https://dcs.adobedc.net/collection/e75dcb5247eb65e7385df30270192e80b145566f52ed74d570505bd2e82463f3"
},
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "59c0e53a2dc84f7791ecc1b3d6e51d5e",
"mappingVersion": 0
}
}
],
"runs": "/runs?property=flowId==4982698b-e6b3-48c2-8dcf-040e20121fd2",
"providerRefId": "c4726e6f-64b4-4b3b-97e3-f128ace0cc74",
"lastOperation": {
"started": 0,
"updated": 0,
"operation": "enable"
}
}
]
}
附錄 appendix
下節提供監視、更新和刪除資料流的步驟相關資訊。
監視資料流 monitor-dataflow
建立資料流後,您可以監視透過該資料流擷取的資料,以檢視有關資料流執行、完成狀態和錯誤的資訊。 如需完整的API範例,請閱讀以下指南: 使用API監控您的來源資料流.
更新您的資料流 update-dataflow
透過向以下專案發出PATCH請求,更新資料流的詳細資訊,例如其名稱和說明,以及其執行排程和相關聯的對應集 /flows
端點 Flow Service API,同時提供資料流的ID。 提出PATCH請求時,您必須提供資料流的 etag
在 If-Match
標頭。 如需完整的API範例,請閱讀以下指南: 使用API更新來源資料流
更新您的帳戶 update-account
透過對執行PATCH請求,更新來源帳戶的名稱、說明和認證 Flow Service API,同時提供您的基本連線ID作為查詢引數。 提出PATCH請求時,您必須提供來源帳戶的唯一值 etag
在 If-Match
標頭。 如需完整的API範例,請閱讀以下指南: 使用API更新您的來源帳戶.
刪除您的資料流 delete-dataflow
透過對執行DELETE請求來刪除您的資料流 Flow Service API,同時提供您要刪除之資料流的ID做為查詢引數的一部分。 如需完整的API範例,請閱讀以下指南: 使用API刪除您的資料流.
刪除您的帳戶 delete-account
向以下網站執行DELETE請求,刪除您的帳戶: Flow Service API,同時提供您要刪除之帳戶的基本連線ID。 如需完整的API範例,請閱讀以下指南: 使用API刪除您的來源帳戶.