探索您的來源
使用您在上一步中產生的基本連線ID,您可以執行GET要求來探索檔案和目錄。
使用以下呼叫來尋找您要帶入Experience Platform的檔案路徑:
API格式
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=rest&object={OBJECT}&fileType={FILE_TYPE}&preview={PREVIEW}&sourceParams={SOURCE_PARAMS}
執行GET請求以探索來源的檔案結構和內容時,您必須包含下表列出的查詢引數:
參數 | 說明 |
---|---|
{BASE_CONNECTION_ID} | 在上一步中產生的基本連線ID。 |
objectType=rest | 您要探索的物件型別。 目前,此值一律設為rest 。 |
{OBJECT} | 只有在檢視特定目錄時才需要此引數。 其值代表您要探索的目錄路徑。 |
fileType=json | 您要帶入Experience Platform的檔案型別。 目前,json 是唯一受支援的檔案型別。 |
{PREVIEW} | 布林值,定義連線的內容是否支援預覽。 |
{SOURCE_PARAMS} | 為您要帶入Experience Platform的來源檔案定義引數。 若要擷取{SOURCE_PARAMS} 接受的格式型別,您必須以base64編碼整個list_id 字串。 在下列範例中,以base64編碼的"list_id": "10c097ca71" 等於eyJsaXN0SWQiOiIxMGMwOTdjYTcxIn0= 。 |
要求
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/connections/70383d02-2777-4be7-a309-9dd6eea1b46d/explore?objectType=rest&object=json&fileType=json&preview=true&sourceParams=eyJsaXN0SWQiOiIxMGMwOTdjYTcxIn0=' \
-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}'
回應
成功的回應會傳回查詢檔案的結構。
{
"data": [
{
"members": [
{
"id": "cff65fb4c5f5828666ad846443720efd",
"email_address": "roykent@gmail.com",
"unique_email_id": "72c758cbf1",
"full_name": "Roy Kent",
"web_id": 547094062,
"email_type": "html",
"status": "subscribed",
"merge_fields": {
"FNAME": "Roy",
"LNAME": "Kent",
"ADDRESS": {
"addr1": "",
"addr2": "",
"city": "Richmond",
"state": "Virginia",
"zip": "",
"country": "US"
},
"PHONE": "",
"BIRTHDAY": ""
},
"stats": {
"avg_open_rate": 0,
"avg_click_rate": 0
},
"ip_signup": "",
"timestamp_signup": "",
"ip_opt": "103.43.112.97",
"timestamp_opt": "2021-06-01T15:31:36+00:00",
"member_rating": 2,
"last_changed": "2021-06-01T15:31:36+00:00",
"language": "",
"vip": false,
"email_client": "",
"location": {
"latitude": 0,
"longitude": 0,
"gmtoff": 0,
"dstoff": 0,
"country_code": "",
"timezone": ""
},
"source": "Admin Add",
"tags_count": 0,
"tags": [
],
"list_id": "10c097ca71"
}
],
"list_id": "10c097ca71",
"total_items": 2,
"_links": [
{
"rel": "self",
"href": "https://us6.api.mailchimp.com/3.0/lists/10c097ca71/members",
"method": "GET",
"targetSchema": "https://us6.api.mailchimp.com/schema/3.0/Definitions/Lists/Members/CollectionResponse.json",
"schema": "https://us6.api.mailchimp.com/schema/3.0/Paths/Lists/Members/Collection.json"
},
{
"rel": "parent",
"href": "https://us6.api.mailchimp.com/3.0/lists/10c097ca71",
"method": "GET",
"targetSchema": "https://us6.api.mailchimp.com/schema/3.0/Definitions/Lists/Members/Response.json"
},
{
"rel": "create",
"href": "https://us6.api.mailchimp.com/3.0/lists/10c097ca71/members",
"method": "POST",
"targetSchema": "https://us6.api.mailchimp.com/schema/3.0/Definitions/Lists/Members/Response.json",
"schema": "https://us6.api.mailchimp.com/schema/3.0/Definitions/Lists/Members/POST.json"
}
]
}
]
}
建立來源連線
您可以對Flow Service API發出POST要求,以建立來源連線。 來源連線由連線ID、來源資料檔案的路徑以及連線規格ID組成。
API格式
POST /sourceConnections
要求
下列要求會建立 YOURSOURCE 的來源連線:
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": "{YOURSOURCE} Source Connection",
"description": "{YOURSOURCE} Source Connection",
"baseConnectionId": "70383d02-2777-4be7-a309-9dd6eea1b46d",
"connectionSpec": {
"id": "6360f136-5980-4111-8bdf-15d29eab3b5a",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
"server": "us6",
"listId": "10c097ca71"
}
}'
屬性 | 說明 |
---|---|
name | 來源連線的名稱。 確保來源連線的名稱是描述性的,因為您可以使用此名稱來查詢來源連線的資訊。 |
description | 您可以納入的選用值,可提供來源連線的詳細資訊。 |
baseConnectionId | YOURSOURCE 的基礎連線識別碼。 此ID是在先前步驟中產生的。 |
connectionSpec.id | 與您的來源對應的連線規格ID。 |
data.format | 您要擷取的 YOURSOURCE 資料格式。 目前唯一支援的資料格式為json 。 |
回應
成功的回應會傳回新建立的來源連線的唯一識別碼(id
)。 在後續步驟中需要此ID才能建立資料流。
{
"id": "246d052c-da4a-494a-937f-a0d17b1c6cf5",
"etag": "\"712a8c08-fda7-41c2-984b-187f823293d8\""
}
建立目標XDM結構描述
為了在Experience Platform中使用來源資料,必須建立目標結構描述,以根據您的需求建構來源資料。 然後使用目標結構描述來建立包含來源資料的Experience Platform資料集。
可透過對結構描述登入API執行POST要求來建立目標XDM結構描述。
如需有關如何建立目標XDM結構描述的詳細步驟,請參閱有關使用API 建立結構描述的教學課程。
建立目標資料集
可透過對目錄服務API執行POST要求,在承載中提供目標結構描述的ID,來建立目標資料集。
如需有關如何建立目標資料集的詳細步驟,請參閱有關使用API建立資料集的教學課程。
建立目標連線
目標連線代表與要儲存所擷取資料的目的地之間的連線。 若要建立目標連線,您必須提供對應至Data Lake的固定連線規格識別碼。 此ID為: c604ff05-7f1a-43c0-8e18-33bf874cb11c
。
您現在擁有目標結構描述、目標資料集和與Data Lake的連線規格ID的唯一識別碼。 使用這些識別碼,您可以使用Flow Service API建立目標連線,以指定將包含傳入來源資料的資料集。
API格式
POST /targetConnections
要求
下列要求會建立 YOURSOURCE 的目標連線:
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": "{YOURSOURCE} Target Connection",
"description": "{YOURSOURCE} Target Connection",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
"dataSetId": "5ef4551c52e054191a61a99f"
}
}'
屬性 | 說明 |
---|---|
name | 目標連線的名稱。 請確定目標連線的名稱是描述性的,因為您可以使用此名稱來查詢目標連線的資訊。 |
description | 您可以納入的選用值,可提供目標連線的詳細資訊。 |
connectionSpec.id | 對應至Data Lake的連線規格識別碼。 此固定ID為: c604ff05-7f1a-43c0-8e18-33bf874cb11c 。 |
data.format | 您要帶至Experience Platform的 YOURSOURCE 資料格式。 |
params.dataSetId | 在上一步中擷取的目標資料集ID。 |
回應
成功的回應會傳回新目標連線的唯一識別碼(id
)。 此ID在後續步驟中是必要的。
{
"id": "7c96c827-3ffd-460c-a573-e9558f72f263",
"etag": "\"a196f685-f5e8-4c4c-bfbd-136141bb0c6d\""
}
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/995dabbea86d58e346ff91bd8aa741a9f36f29b1019138d4",
"xdmVersion": "1.0",
"id": null,
"mappings": [
{
"destinationXdmPath": "_id",
"sourceAttribute": "Id",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "person.name.firstName",
"sourceAttribute": "FirstName",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
},
{
"destinationXdmPath": "person.name.lastName",
"sourceAttribute": "LastName",
"identity": false,
"identityGroup": null,
"namespaceCode": null,
"version": 0
}
]
}'
屬性 | 說明 |
---|---|
xdmSchema | 在先前步驟中產生的目標XDM結構描述識別碼。 |
mappings.destinationXdmPath | 來源屬性對應到的目的地XDM路徑。 |
mappings.sourceAttribute | 需要對映至目的地XDM路徑的來源屬性。 |
mappings.identity | 布林值,指定是否將對應集標示為Identity Service。 |
回應
成功的回應會傳回新建立的對應詳細資料,包括其唯一識別碼(id
)。 在後續步驟中需要此值,才能建立資料流。
{
"id": "bf5286a9c1ad4266baca76ba3adc9366",
"version": 0,
"createdDate": 1597784069368,
"modifiedDate": 1597784069368,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
建立流程
從 YOURSOURCE 將資料引進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": "{YOURSOURCE} dataflow",
"description": "{YOURSOURCE} dataflow",
"flowSpec": {
"id": "6499120c-0b15-42dc-936e-847ea3c24d72",
"version": "1.0"
},
"sourceConnectionIds": [
"246d052c-da4a-494a-937f-a0d17b1c6cf5"
],
"targetConnectionIds": [
"7c96c827-3ffd-460c-a573-e9558f72f263"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "bf5286a9c1ad4266baca76ba3adc9366",
"mappingVersion": "0"
}
}
],
"scheduleParams": {
"startTime": "1625040887",
"frequency": "minute",
"interval": 15
}
}'
屬性 | 說明 |
---|---|
name | 資料流的名稱。 確保資料流的名稱是描述性的,因為您可以使用此名稱來查閱資料流上的資訊。 |
description | 您可以納入的選用值,可提供資料流的詳細資訊。 |
flowSpec.id | 建立資料流所需的流量規格ID。 此固定ID為: 6499120c-0b15-42dc-936e-847ea3c24d72 。 |
flowSpec.version | 流程規格ID的對應版本。 此值預設為1.0 。 |
sourceConnectionIds | 在先前步驟中產生的來源連線識別碼。 |
targetConnectionIds | 在先前步驟中產生的目標連線識別碼。 |
transformations | 此屬性包含套用至資料所需的各種轉換。 將非XDM相容的資料引進Experience Platform時,需要此屬性。 |
transformations.name | 指定給轉換的名稱。 |
transformations.params.mappingId | 在先前步驟中產生的對應ID。 |
transformations.params.mappingVersion | 對應ID的對應版本。 此值預設為0 。 |
scheduleParams.startTime | 此屬性包含資料流擷取排程的相關資訊。 |
scheduleParams.frequency | 資料流收集資料的頻率。 可接受的值包括: once 、minute 、hour 、day 或week 。 |
scheduleParams.interval | 間隔會指定兩個連續資料流執行之間的期間。 間隔的值應為非零整數。 當頻率設定為once 時不需要間隔,其他頻率值應該大於或等於15 。 |
回應
成功的回應會傳回新建立的資料流識別碼(id
)。 您可以使用此ID來監視、更新或刪除資料流。
{
"id": "993f908f-3342-4d9c-9f3c-5aa9a189ca1a",
"etag": "\"510bb1d4-8453-4034-b991-ab942e11dd8a\""
}