(測試版)為以下專案建立來源連線和資料流: SugarCRM Events 使用流量服務API
下列教學課程將逐步引導您完成建立 SugarCRM Events 來源連線並建立資料流以帶來 SugarCRM 使用將事件資料匯入Adobe Experience Platform Flow Service API.
快速入門
本指南需要您深入了解下列 Experience Platform 元件:
以下小節提供成功連線所需的其他資訊 SugarCRM 使用 Flow Service API。
收集必要的認證
為了連線 SugarCRM Events 至Platform,您必須提供下列連線屬性的值:
host
developer.salesfusion.com
username
abc.def@example.com@sugarmarketdemo000.com
password
123456789
連線 SugarCRM Events 至平台,使用 Flow Service API
以下概述驗證您的憑證所需的步驟 SugarCRM 來源、建立來源連線,並建立資料流以將您的事件資料引進Experience Platform。
建立基礎連線 base-connection
基礎連線會保留您的來源和平台之間的資訊,包括來源的驗證認證、連線的目前狀態,以及您唯一的基本連線ID。 基礎連線ID可讓您從來源內部探索及導覽檔案,並識別您要擷取的特定專案,包括其資料型別和格式的資訊。
若要建立基本連線ID,請向以下連線ID發出POST請求: /connections
端點,同時提供 SugarCRM Events 要求內文中的驗證認證。
API格式
POST /connections
要求
下列要求會建立 SugarCRM Events:
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": "SugarCRM Events base connection",
"description": "Create a live inbound connection to your SugarCRM Events instance, to ingest both historic and scheduled data into Experience Platform",
"connectionSpec": {
"id": "59a4b493-a615-40f9-bd38-f823d0909a2b",
"version": "1.0"
},
"auth": {
"specName": "OAuth2 Refresh Code",
"params": {
"host": "developer.salesfusion.com",
"username": "{SUGARCRM_DEVELOPER_ACCOUNT_USERNAME}",
"password": "{SUGARCRM_DEVELOPER_ACCOUNT_PASSWORD}"
}
}
}'
name
description
connectionSpec.id
auth.specName
auth.params.host
auth.params.username
auth.params.password
回應
成功的回應會傳回新建立的基本連線,包括其唯一的連線識別碼(id
)。 在下一步中探索來源的檔案結構和內容時,需要此ID。
{
"id": "f5421911-6f6c-41c7-aafa-5d9d2ce51535",
"etag": "\"4d08164f-0000-0200-0000-6368b7bf0000\""
}
探索您的來源 explore
使用您在上一步中產生的基本連線ID,您可以透過執行GET請求來探索檔案和目錄。
使用以下呼叫來尋找您要帶入的檔案路徑 Platform:
API格式
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=rest&object={OBJECT}&fileType={FILE_TYPE}&preview={PREVIEW}&sourceParams={SOURCE_PARAMS}
執行GET請求以探索來源的檔案結構和內容時,您必須包括下表列出的查詢引數:
{BASE_CONNECTION_ID}
objectType=rest
rest
.{OBJECT}
json
.fileType=json
json
是唯一支援的檔案型別。{PREVIEW}
{SOURCE_PARAMS}
{SOURCE_PARAMS}
,您必須以base64編碼整個字串。SugarCRM Events 不需要任何裝載。 的值
{SOURCE_PARAMS}
傳遞為 {}
,以base64編碼,等於 e30=
如下所示。要求
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/connections/f5421911-6f6c-41c7-aafa-5d9d2ce51535/explore?objectType=rest&object=json&fileType=json&preview=true&sourceParams=e30=' \
-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}'
回應
成功的回應會傳回查詢檔案的結構。 已移除部分記錄,以便呈現更好的簡報。
{
"format": "hierarchical",
"schema": {
"type": "object",
"properties": {
"next": {
"type": "string"
},
"page_number": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"previous": {},
"total_count": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"count": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"results": {
"type": "object",
"properties": {
"sessions": {
"type": "string"
},
"description": {
"type": "string"
},
"created_by": {
"type": "string"
},
"event_id": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"name": {
"type": "string"
},
"updated_by": {
"type": "string"
},
"updated_by_id": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"updated_date": {
"type": "string"
},
"created_date": {
"type": "string"
},
"created_by_id": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"event": {
"type": "string"
},
"folder_id": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"status": {
"type": "string"
}
}
},
"page_size": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
}
}
},
"data": [
{
"next": "https://developer.salesfusion.com/api/2.0/events/?date_field=updated_date&page=2",
"page_number": 1,
"total_count": 532,
"count": 532,
"results": {
"event_id": 1,
"event": "https://developer.salesfusion.com/api/2.0/events/1/",
"sessions": "https://developer.salesfusion.com/api/2.0/events/1/sessions/",
"name": "Test",
"updated_date": "2022-08-30T11:20:11.813Z",
"updated_by_id": 59,
"updated_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"created_date": "2022-08-28T23:40:11Z",
"created_by_id": 59,
"created_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"status": "Draft",
"folder_id": 2
},
"page_size": 100
},
{
"next": "https://developer.salesfusion.com/api/2.0/events/?date_field=updated_date&page=2",
"page_number": 1,
"total_count": 532,
"count": 532,
"results": {
"event_id": 2,
"event": "https://developer.salesfusion.com/api/2.0/events/2/",
"sessions": "https://developer.salesfusion.com/api/2.0/events/2/sessions/",
"name": "Infy Event",
"description": "Test Event",
"updated_date": "2022-09-15T16:26:43.697Z",
"updated_by_id": 59,
"updated_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"created_date": "2022-09-27T23:40:11Z",
"created_by_id": 59,
"created_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"status": "Active",
"folder_id": 2
},
"page_size": 100
},
{
"next": "https://developer.salesfusion.com/api/2.0/events/?date_field=updated_date&page=2",
"page_number": 1,
"total_count": 532,
"count": 532,
"results": {
"event_id": 3,
"event": "https://developer.salesfusion.com/api/2.0/events/3/",
"sessions": "https://developer.salesfusion.com/api/2.0/events/3/sessions/",
"name": "Infy Workshop 1",
"updated_date": "2022-10-11T18:12:28.767Z",
"updated_by_id": 59,
"updated_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"created_date": "2022-09-14T23:40:11Z",
"created_by_id": 59,
"created_by": "https://developer.salesfusion.com/api/2.0/users/59/",
"status": "Active",
"folder_id": 2
},
"page_size": 100
}
]
}
建立來源連線 source-connection
您可以透過向以下發出POST請求來建立來源連線: Flow Service API。 來源連線由連線ID、來源資料檔案的路徑以及連線規格ID組成。
API格式
POST /sourceConnections
要求
以下請求會為建立來源連線 SugarCRM Events:
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": "SugarCRM Source Connection",
"description": "SugarCRM Source Connection",
"baseConnectionId": "f5421911-6f6c-41c7-aafa-5d9d2ce51535",
"connectionSpec": {
"id": "63d2b27b-69a5-45c9-a7fe-78148a25de3c",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
}
}'
name
description
baseConnectionId
connectionSpec.id
data.format
json
.回應
成功的回應會傳回唯一識別碼(id
)。 在後續步驟中需要此ID才能建立資料流。
{
"id": "ffac1ae1-c137-4133-9f8d-0279468c11c9",
"etag": "\"ed05abc3-0000-0200-0000-6368b3280000\""
}
建立目標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
要求
以下請求會為建立目標連線 SugarCRM Events:
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": "SugarCRM Target Connection Generic Rest",
"description": "SugarCRM Target Connection Generic Rest",
"connectionSpec": {
"id": "63d2b27b-69a5-45c9-a7fe-78148a25de3c",
"version": "1.0"
},
"data": {
"format": "parquet_xdm",
"schema": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/b156e6f818f923e048199173c45e55e20fd2487f5eb03d22",
"version": "1.22"
}
},
"params": {
"dataSetId": "6365389d1d37d01c077a81da"
}
}'
name
description
connectionSpec.id
6b137bf6-d2a0-48c8-914b-d50f4942eb85
.data.format
params.dataSetId
回應
成功回應會傳回新目標連線的唯一識別碼(id
)。 此ID在後續步驟中是必要的。
{
"id": "dfe9113e-be98-4d63-80a9-f41761721049",
"etag": "\"84050267-0000-0200-0000-6368b3640000\""
}
建立對應 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/b156e6f818f923e048199173c45e55e20fd2487f5eb03d22",
"contentType": "application/vnd.adobe.xed-full+json;version=1"
}
},
"mappings": [
{
"sourceType": "ATTRIBUTE",
"source": "results.created_by",
"destination": "_extconndev.created_by"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.created_by_id",
"destination": "_extconndev.created_by_id"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.created_date",
"destination": "_extconndev.created_date"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.name",
"destination": "_extconndev.name_event"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.event_id",
"destination": "_extconndev.id_event"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.event_id",
"destination": "_id"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.sessions",
"destination": "_extconndev.sessions"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.updated_by",
"destination": "_extconndev.updated_by"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.updated_by_id",
"destination": "_extconndev.updated_by_id"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.updated_date",
"destination": "_extconndev.updated_date"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.updated_date",
"destination": "timestamp"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.event",
"destination": "_extconndev.event"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.description",
"destination": "_extconndev.description"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.folder_id",
"destination": "_extconndev.folder_id"
},
{
"sourceType": "ATTRIBUTE",
"source": "results.status",
"destination": "_extconndev.status"
}
]
}'
outputSchema.schemaRef.id
mappings.sourceType
mappings.source
mappings.destination
回應
成功的回應會傳回新建立的對應詳細資訊,包括其唯一識別碼(id
)。 在後續步驟中需要此值,才能建立資料流。
{
"id": "d3845beaceeb49669228973f5f937f89",
"version": 0,
"createdDate": 1597784069368,
"modifiedDate": 1597784069368,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
建立流程 flow
從匯入資料的最後一步 SugarCRM Events 到Platform就是建立資料流。 到現在為止,您已準備下列必要值:
資料流負責從來源排程及收集資料。 您可以執行POST要求,同時在裝載中提供先前提到的值,藉此建立資料流。
若要排程內嵌,您必須先將開始時間值設為以秒為單位的epoch時間。 然後,您必須將頻率值設定為 hour
或 day
. 間隔值會指定兩個連續擷取之間的期間。 間隔值應設為 1
或 24
依據 scheduleParams.frequency
選取 hour
或 day
.
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": "SugarCRM Connector Description Flow Generic Rest",
"description": "SugarCRM Connector Description Flow Generic Rest",
"flowSpec": {
"id": "6499120c-0b15-42dc-936e-847ea3c24d72",
"version": "1.0"
},
"sourceConnectionIds": [
"8f1fc72a-f562-4a1d-8597-85b5ca1b1cd3"
],
"targetConnectionIds": [
"6b137bf6-d2a0-48c8-914b-d50f4942eb85"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "d3845beaceeb49669228973f5f937f89",
"mappingVersion": "0"
}
}
],
"scheduleParams": {
"startTime": "1625040887",
"frequency": "hour",
"interval": 1
}
}'
name
description
flowSpec.id
6499120c-0b15-42dc-936e-847ea3c24d72
.flowSpec.version
1.0
.sourceConnectionIds
targetConnectionIds
transformations
transformations.name
transformations.params.mappingId
transformations.params.mappingVersion
0
.scheduleParams.startTime
scheduleParams.frequency
hour
或 day
.scheduleParams.interval
1
或 24
依據 scheduleParams.frequency
選取 hour
或 day
.回應
成功的回應會傳回ID (id
)。 您可以使用此ID來監視、更新或刪除資料流。
{
"id": "fcd16140-81b4-422a-8f9a-eaa92796c4f4",
"etag": "\"9200a171-0000-0200-0000-6368c1da0000\""
}
附錄
下節提供監視、更新和刪除資料流的步驟相關資訊。
監視資料流
建立資料流後,您可以監視透過該資料流擷取的資料,以檢視有關資料流執行、完成狀態和錯誤的資訊。 如需完整的API範例,請閱讀以下指南: 使用API監控您的來源資料流.
更新您的資料流
透過向以下專案發出PATCH請求,更新資料流的詳細資訊,例如其名稱和說明,以及其執行排程和相關聯的對應集 /flows
端點 Flow Service API,同時提供資料流的ID。 提出PATCH請求時,您必須提供資料流的 etag
在 If-Match
標頭。 如需完整的API範例,請閱讀以下指南: 使用API更新來源資料流
更新您的帳戶
透過對執行PATCH請求,更新來源帳戶的名稱、說明和認證 Flow Service API,同時提供您的基本連線ID作為查詢引數。 提出PATCH請求時,您必須提供來源帳戶的唯一值 etag
在 If-Match
標頭。 如需完整的API範例,請閱讀以下指南: 使用API更新您的來源帳戶.
刪除您的資料流
透過對執行DELETE請求來刪除您的資料流 Flow Service API,同時提供您要刪除之資料流的ID做為查詢引數的一部分。 如需完整的API範例,請閱讀以下指南: 使用API刪除您的資料流.
刪除您的帳戶
向以下網站執行DELETE請求,刪除您的帳戶: Flow Service API,同時提供您要刪除之帳戶的基本連線ID。 如需完整的API範例,請閱讀以下指南: 使用API刪除您的來源帳戶.