Beta 版
使用流服务API为Oracle NetSuite Activities创建源连接和数据流
创建对象:
- 开发人员
阅读以下教程,了解如何使用Flow Service API将Oracle NetSuite Activities帐户中的事件数据引入Adobe Experience Platform。
快速入门
本指南要求您对Experience Platform的以下组件有一定的了解:
以下部分提供使用Flow Service API成功连接到Oracle NetSuite Activities所需了解的其他信息。
身份验证
有关如何检索身份验证凭据的信息,请阅读Oracle NetSuite 概述。
使用Experience Platform API
有关如何成功调用Experience Platform API的信息,请参阅Experience Platform API快速入门指南。
使用Flow Service API将Oracle NetSuite Activities连接到Experience Platform
按照以下指南了解如何对Oracle NetSuite Activities源进行身份验证、创建源连接和创建数据流以将事件数据引入Experience Platform。
创建基本连接
基本连接会保留源与Experience Platform之间的信息,包括源的身份验证凭据、连接的当前状态以及唯一的基本连接ID。 基本连接ID允许您浏览和浏览源中的文件,并标识要摄取的特定项目,包括有关其数据类型和格式的信息。
要创建基本连接ID,请在提供您的Oracle NetSuite Activities身份验证凭据作为请求正文的一部分时,向/connections
端点发出POST请求。
API格式
POST /connections
请求
以下请求为Oracle NetSuite Activities创建基本连接:
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": "Oracle NeSuite Activities base connection",
"description": "Authenticated base connection for Oracle NetSuite Activities",
"connectionSpec": {
"id": "fdf850b4-5a8d-4a5a-9ce8-4caef9abb2a8",
"version": "1.0"
},
"auth": {
"specName": "OAuth2 Client Credential",
"params": {
"clientId": "{CLIENT_ID}",
"clientSecret": "{CLIENT_SECRET}"
"accessTokenUrl": "{ACCESS_TOKEN_URL}",
"accessToken": "{ACCESS_TOKEN_URL}"
}
}
}'
name
description
connectionSpec.id
auth.specName
auth.params.clientId
7fce.....b42f
类似的64个字符的字符串。auth.params.clientSecret
5c98.....1b46
类似的64个字符的字符串。auth.params.accessTokenUrl
https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
,您将在其中将ACCOUNT_ID替换为您的NetSuite帐户ID。auth.params.accessToken
eyJr......f4V0
。响应
成功的响应返回新创建的基本连接,包括其唯一连接标识符(id
)。 在下一步中浏览源的文件结构和内容时,需要此ID。
{
"id": "60c81023-99b4-4aae-9c31-472397576dd2",
"etag": "\"fa003785-0000-0200-0000-6555c5310000\""
}
浏览您的源
获得基本连接ID后,您现在可以通过对/connections
端点执行GET请求来探索源数据的内容和结构,同时将基本连接ID作为查询参数提供。
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为整个字符串进行编码。Oracle NetSuite Activities的值为空。
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%3D' \
-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}'
响应
成功的响应会返回类似于以下内容的JSON结构:
{
"format": "hierarchical",
"schema": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"offset": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"count": {
"type": "integer",
"minimum": -9007199254740992,
"maximum": 9007199254740991
},
"hasMore": {
"type": "boolean"
},
"links": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rel": {
"type": "string"
},
"href": {
"type": "string"
}
}
}
},
"items": {
"type": "object",
"properties": {
"owner": {
"type": "string"
},
"createddate": {
"type": "string"
},
"lastmodifieddate": {
"type": "string"
},
"accesslevel": {
"type": "string"
},
"alldayevent": {
"type": "string"
},
"message": {
"type": "string"
},
"startdate": {
"type": "string"
},
"title": {
"type": "string"
},
"organizer": {
"type": "string"
},
"response": {
"type": "string"
},
"links": {
"type": "array",
"items": {
"type": "object",
"properties": {}
}
},
"location": {
"type": "string"
},
"timedevent": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"type": "string"
}
}
}
}
},
"data": [
{
"totalResults": 13,
"offset": 0,
"count": 13,
"hasMore": false,
"links": [
{
"rel": "self",
"href": "https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql"
}
],
"items": {
"accesslevel": "BUSY",
"alldayevent": "F",
"createddate": "2022-12-15",
"id": "5",
"lastmodifieddate": "2022-12-15",
"location": "Caffe West",
"message": "Bring Monthly Results",
"organizer": "-5",
"owner": "-5",
"response": "ACCEPTED",
"startdate": "2022-12-15",
"status": "CONFIRMED",
"timedevent": "T",
"title": "Meeting with Tom"
}
},
{
"totalResults": 13,
"offset": 0,
"count": 13,
"hasMore": false,
"links": [
{
"rel": "self",
"href": "https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql"
}
],
"items": {
"accesslevel": "BUSY",
"alldayevent": "F",
"createddate": "2023-02-01",
"id": "103",
"lastmodifieddate": "2023-02-01",
"location": "Caffe West",
"message": "Bring Monthly Results",
"organizer": "-5",
"owner": "-5",
"response": "ACCEPTED",
"startdate": "2022-12-15",
"status": "CONFIRMED",
"timedevent": "T",
"title": "Meeting with Tom"
}
},
{
"totalResults": 13,
"offset": 0,
"count": 13,
"hasMore": false,
"links": [
{
"rel": "self",
"href": "https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql"
}
],
"items": {
"accesslevel": "BUSY",
"alldayevent": "F",
"createddate": "2023-11-09",
"id": "204",
"lastmodifieddate": "2023-11-09",
"location": "Caffe West",
"message": "Bring Monthly Results",
"organizer": "-5",
"owner": "-5",
"response": "ACCEPTED",
"startdate": "2023-12-15",
"status": "CONFIRMED",
"timedevent": "T",
"title": "Meeting with Tom"
}
},
]
}
创建源连接
您可以通过向Flow Service API的/sourceConnections
端点发出POST请求来创建源连接。 源连接由连接ID、源数据文件的路径以及连接规范ID组成。
API格式
POST /sourceConnections
请求
以下请求为Oracle NetSuite Activities创建源连接。
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": "Oracle NetSuite Activities Source Connection",
"description": "Oracle NetSuite Activities Source Connection",
"baseConnectionId": "60c81023-99b4-4aae-9c31-472397576dd2",
"connectionSpec": {
"id": "fdf850b4-5a8d-4a5a-9ce8-4caef9abb2a8",
"version": "1.0"
},
"data": {
"format": "json"
},
"params": {
}
}'
name
description
baseConnectionId
connectionSpec.id
data.format
json
。成功的响应返回新创建的源连接的唯一标识符(id
)。 此ID是稍后步骤创建数据流所必需的。
{
"id": "574c049f-29fc-411f-be0d-f80002025f51",
"etag": "\"0704acb3-0000-0200-0000-6555c5470000\""
}
创建目标数据集
通过向目录服务API执行POST请求,在有效负载中提供目标架构的ID,可以创建目标数据集。
有关如何创建目标数据集的详细步骤,请参阅有关使用API创建数据集的教程。
创建目标连接
目标连接表示与要存储所摄取数据的目标的连接。 要创建目标连接,您必须提供对应于数据湖的固定连接规范ID。 此ID为: c604ff05-7f1a-43c0-8e18-33bf874cb11c
。
现在,您拥有目标架构、目标数据集以及到数据湖的连接规范ID。 使用这些标识符,您可以使用Flow Service API创建目标连接,以指定将包含入站源数据的数据集。
API格式
POST /targetConnections
请求
以下请求为Oracle NetSuite Activities创建目标连接:
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": "Oracle NetSuite Activities Target Connection Generic Rest",
"description": "Oracle NetSuite Activities Target Connection Generic Rest",
"connectionSpec": {
"id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
"version": "1.0"
},
"data": {
"format": "parquet_xdm",
"schema": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/325fd5394ba421246b05c0a3c2cd5efeec2131058a63d473",
"version": "1.2"
}
},
"params": {
"dataSetId": "65004470082ac828d2c3d6a0"
}
}'
name
description
connectionSpec.id
6b137bf6-d2a0-48c8-914b-d50f4942eb85
。data.format
params.dataSetId
响应
成功的响应返回新目标连接的唯一标识符(id
)。 此ID在后续步骤中是必需的。
{
"id": "382fc614-3c5b-46b9-a971-786fb0ae6c5d",
"etag": "\"e0016100-0000-0200-0000-655707a40000\""
}
POST /conversion/mappingSets
请求
以下请求为DNL NetSuite Activities创建映射
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": "items.id",
"destination": "_extconndev.NSA_ID"
},
{
"sourceType": "ATTRIBUTE",
"source": "items.title",
"destination": "_extconndev.NSA_title"
},
{
"sourceType": "ATTRIBUTE",
"source": "items.createddate",
"destination": "_extconndev.NSA_createddate"
},
{
"sourceType": "ATTRIBUTE",
"source": "items.location",
"destination": "_extconndev.NSA_location"
},
{
"sourceType": "ATTRIBUTE",
"source": "items.lastmodifieddate",
"destination": "_extconndev.NSA_lastmodifieddate"
}
],
"outputSchema": {
"schemaRef": {
"id": "https://ns.adobe.com/{TENANT_ID}/schemas/325fd5394ba421246b05c0a3c2cd5efeec2131058a63d473",
"contentType": "application/vnd.adobe.xed-full+json;version=1"
}
}
}'
outputSchema.schemaRef.id
mappings.sourceType
mappings.source
mappings.destination
响应
成功的响应返回新创建的映射的详细信息,包括其唯一标识符(id
)。 在后续步骤中需要使用此值来创建数据流。
{
"id": "ddf0592bcc9d4ac391803f15f2429f87",
"version": 0,
"createdDate": 1597784069368,
"modifiedDate": 1597784069368,
"createdBy": "{CREATED_BY}",
"modifiedBy": "{MODIFIED_BY}"
}
创建流
将数据从Oracle NetSuite Activities引入Experience 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": "Oracle NetSuite Activities connector Flow Generic Rest",
"description": "Oracle NetSuite Activities connector Description Flow Generic Rest",
"flowSpec": {
"id": "6499120c-0b15-42dc-936e-847ea3c24d72",
"version": "1.0"
},
"sourceConnectionIds": [
"d8827440-339f-428d-bf38-5e2ab1f0f7bb"
],
"targetConnectionIds": [
"e349a15e-c639-4047-8b2a-154aa7a857d7"
],
"transformations": [
{
"name": "Mapping",
"params": {
"mappingId": "10787532e0994eb686e76bdab69a9e88",
"mappingVersion": 0
}
}
],
"scheduleParams": {
"startTime": 1700202649,
"frequency": "once"
}
}'
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
scheduleParams.interval
响应
成功的响应返回新创建的数据流的ID (id
)。 您可以使用此ID监视、更新或删除数据流。
{
"id": "84c64142-1741-4b0b-95a9-65644eba0cf6",
"etag": "\"3901770b-0000-0200-0000-655708970000\""
}
附录
以下部分提供了有关监视、更新和删除数据流的步骤的信息。
监测数据流
创建数据流后,您可以监视通过它摄取的数据,以查看有关流运行、完成状态和错误的信息。 有关完整的API示例,请阅读有关使用API监视源数据流的指南。
更新您的数据流
通过提供数据流的ID,向Flow Service API的/flows
端点发出PATCH请求来更新数据流的详细信息,例如其名称和描述,以及其运行计划和关联的映射集。 发出PATCH请求时,必须在If-Match
标头中提供数据流唯一的etag
。 有关完整的API示例,请阅读有关使用API更新源数据流的指南。
更新您的帐户
在提供基本连接ID作为查询参数的同时,通过向Flow Service API执行PATCH请求来更新源帐户的名称、描述和凭据。 发出PATCH请求时,必须在If-Match
标头中提供源帐户的唯一etag
。 有关完整的API示例,请阅读有关使用API更新源帐户的指南。
删除您的数据流
在查询参数中提供要删除的数据流的ID时,通过向Flow Service API执行DELETE请求来删除数据流。 有关完整的API示例,请阅读有关使用API删除数据流的指南。
删除您的帐户
在提供要删除的帐户的基本连接ID时,通过向Flow Service API执行DELETE请求来删除您的帐户。 有关完整的API示例,请阅读有关使用API🔗删除源帐户的指南。