创建源连接和数据流,以使用Flow Service API流式传输LAVA数据

快速入门

本指南要求您对Experience Platform的以下组件有一定的了解:

  • :使用Experience Platform中的源轻松地从各种系统导入数据。 源可帮助您收集、组织和准备数据,以便您能够充分利用Experience Platform的功能。
  • 沙盒:沙盒允许您在Experience Platform中安全地构建、测试和实验,而不会影响您的生产数据。 他们创建单独的环境,以便您能够试用、开发新功能或与团队协作,而不会产生任何风险。
TIP
在开始本教程之前,请查看LAVA 源连接器概述,确保您满足所有先决条件。

加载LAVA包

LAVA提供了一个包,其中包含我们推荐的用于在Experience Platform中使用LAVA的字段组、架构、身份命名空间和数据集。 建议使用这些包,但不是必需的。

阅读此部分以了解如何将此项导入沙盒,并获取后续步骤所需的ID。

API格式

POST /transfer/pullRequest

请求

以下请求加载LAVA的包:

curl -X POST \
  'https://platform.adobe.io/data/foundation/exim/transfer/pullRequest' \
  -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 '{
    "imsOrgId": "1EF71E43679AAD1E0A495C77@AdobeOrg",
    "packageId": "416a0c2a32794092aa1a957cbe9a6698"
  }'
属性
描述
类型
必需
imsOrgId
资源包源组织的ID。 必须为1EF71E43679AAD1E0A495C77@AdobeOrg
字符串
packageId
要导入的资源包中的ID。 必须为416a0c2a32794092aa1a957cbe9a6698
字符串

响应

成功的响应将返回有关导入的公共包的详细信息。

{
    "id": "{ID}",
    "version": 0,
    "createdDate": 1729658890425,
    "modifiedDate": 1729658890425,
    "createdBy": "{CREATED_BY}",
    "modifiedBy": "{MODIFIED_BY}",
    "sourceIMSOrgId": "{ORG_ID}",
    "targetIMSOrgId": "{TARGET_ID}",
    "packageId": "{PACKAGE_ID}",
    "status": "PENDING",
    "initiatedBy": "{INITIATED_BY}",
    "pipelineMessageId": "{MESSAGE_ID}",
    "requestType": "PUBLIC"
}

检索模式

导入包后,检索LAVA EventsLAVA Profile架构:

请求

curl -X GET \
  'https://platform.adobe.io/data/foundation/schemaregistry/tenant/schemas?name=LAVA*' \
  -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 'Accept: application/vnd.adobe.xed-id+json'

响应

成功的响应将返回架构列表。 在后续步骤中将这些ID用作目标XDM架构。

{
  "results": [
    ...
    {
      "$id": "https://ns.adobe.com/{TENANT_ID}/schemas/7ff102f217d394e8beff48dcc2c27baae14e28e210d36492",
      "meta:altId": "_{TENANT_ID}.schemas.7ff102f217d394e8beff48dcc2c27baae14e28e210d36492",
      "version": "1.4",
      "title": "LAVA Events"
    },
    {
      "$id": "https://ns.adobe.com/{TENANT_ID}/schemas/991bed7f1d94ccf47bd392bc345ee51e7e0bd19b1de3dbff",
      "meta:altId": "_{TENANT_ID}.schemas.991bed7f1d94ccf47bd392bc345ee51e7e0bd19b1de3dbff",
      "version": "1.2",
      "title": "LAVA Profile"
    },
    //...
  ]
}

检索数据集

接下来,使用以下调用检索您的数据集ID。

请求

curl -X GET \
  'https://platform.adobe.io/data/foundation/catalog/dataSets?name=LAVA*' \
  -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 'Accept: application/json'

响应

{
  "6920eb494131bfcc10305302": {
    "id": "6920eb494131bfcc10305302",
    "name": "LAVA Member Profiles",
    //...
  },
  "6920eb7565bd3ed93a35cd0e": {
    "id": "6920eb7565bd3ed93a35cd0e",
    "name": "LAVA Member Rewards",
    //...
  },
  "6924aecd8d9c85e2d56261e3": {
    "id": "6924aecd8d9c85e2d56261e3",
    "name": "LAVA Events",
    "schemaRef": {
      "id": "https://ns.adobe.com/{TENANT_ID}/schemas/7ff102f217d394e8beff48dcc2c27baae14e28e210d36492",
      "contentType": "application/vnd.adobe.xed-full+json;version=1"
    },
    //...
  }
}

使用Flow Service API将LAVA连接到Experience Platform

以下教程将指导您完成创建LAVA源连接和创建数据流以使用Flow Service API将LAVA数据引入Experience Platform的步骤。

创建源连接 source-connection

创建源连接,方法是:向Flow Service API发出POST请求,同时提供源的连接规范ID、名称和描述等详细信息以及数据的格式。

API格式

POST /sourceConnections

请求

以下请求为LAVA创建源连接:

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 a Streaming SDK source",
      "description": "Streaming Source Connection for a Streaming SDK source",
      "connectionSpec": {
          "id": "232dfabe-27aa-41c0-a7cf-9961661dc68b",
          "version": "1.0"
      },
      "data": {
          "format": "json"
      }
    }'
属性
描述
name
源连接的名称。 请确保源连接的名称是描述性的,因为您可以使用此名称查找有关源连接的信息。
description
可包含的可选值,用于提供有关源连接的更多信息。
connectionSpec.id
与源对应的连接规范ID。 对于LAVA必须为232dfabe-27aa-41c0-a7cf-9961661dc68b
data.format
要摄取的LAVA数据的格式。 当前,唯一支持的数据格式为json

响应

成功的响应返回新创建的源连接的唯一标识符(id)。 此ID是稍后步骤创建数据流所必需的。

{
     "id": "246d052c-da4a-494a-937f-a0d17b1c6cf5",
     "etag": "\"712a8c08-fda7-41c2-984b-187f823293d8\""
}

创建目标XDM架构 target-schema

IMPORTANT
如果您导入了LAVA包,请跳过此步骤,因为它包含目标XDM架构。

为了在Experience Platform中使用源数据,必须创建目标架构,以根据您的需求构建源数据。 然后,使用目标架构创建包含源数据的Experience Platform数据集。 如果您使用多个LAVA数据集,例如成员余额和票证扫描事件,则可能需要多个目标XDM架构。

通过对架构注册表API执行POST请求,可以创建目标XDM架构。

有关如何创建目标XDM架构的详细步骤,请参阅有关使用API 创建架构的教程

创建目标数据集 target-dataset

IMPORTANT
如果您已经导入LAVA包,则可以跳过此步骤,因为该包为您提供了目标XDM数据集。 但是,如果您需要多个LAVA数据集(例如,一个用于成员余额,另一个用于票证扫描事件),则应根据需要创建其他目标数据集。

通过向目录服务API执行POST请求,在有效负载中提供目标架构的ID,可以创建目标数据集。

有关如何创建目标数据集的详细步骤,请参阅有关使用API创建数据集的教程

创建目标连接 target-connection

目标连接表示与要存储所摄取数据的目标的连接。 要创建目标连接,您必须提供对应于数据湖的固定连接规范ID。 此ID为: c604ff05-7f1a-43c0-8e18-33bf874cb11c

现在,您拥有目标架构的唯一标识符、目标数据集以及数据湖的连接规范ID。 使用这些标识符,您可以使用Flow Service API创建目标连接,以指定将包含入站源数据的数据集。

API格式

POST /targetConnections

请求

以下请求为LAVA创建目标连接:

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 a Streaming SDK source",
      "description": "Streaming Target Connection for a Streaming SDK source",
      "connectionSpec": {
          "id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
          "version": "1.0"
      },
      "data": {
          "format": "json",
          "schema": {
              "id": "{TARGET_XDM_SCHEMA}",
              "version": "application/vnd.adobe.xed-full+json;version=1"
          }
      },
      "params": {
          "dataSetId": "{TARGET_DATASET}"
      }
  }'
属性
描述
name
目标连接的名称。 确保目标连接的名称是描述性的,因为您可以使用此名称查找有关目标连接的信息。
description
可包含的可选值,用于提供有关目标连接的更多信息。
connectionSpec.id
对应于数据湖的连接规范ID。 此固定ID为: c604ff05-7f1a-43c0-8e18-33bf874cb11c
data.format
要带到Experience Platform的LAVA数据的格式。
params.dataSetId
在上一步中检索到的目标数据集ID。

响应

成功的响应返回新目标连接的唯一标识符(id)。 此ID在后续步骤中是必需的。

{
     "id": "7c96c827-3ffd-460c-a573-e9558f72f263",
     "etag": "\"a196f685-f5e8-4c4c-bfbd-136141bb0c6d\""
}

创建映射 mapping

要将源数据摄取到目标数据集中,必须首先将其映射到目标数据集所遵循的目标架构。 这是通过在请求有效负载中定义数据映射的情况下对Data Prep API执行POST请求来实现的。

在使用LAVA提供的架构时,建议使用以下映射:

成员配置文件
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "_{TENANT_ID}.lavaId",
      "sourceAttribute": "lavaId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "person.name.firstName",
      "sourceAttribute": "firstName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "person.name.lastName",
      "sourceAttribute": "lastName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "personalEmail.address",
      "sourceAttribute": "email",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "mobilePhone.number",
      "sourceAttribute": "phone",
      "identity": false,
      "version": 0
    }
  ]
}
成员余额
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "_{TENANT_ID}.lavaId",
      "sourceAttribute": "lavaId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.balances",
      "sourceAttribute": "balances",
      "identity": false,
      "version": 0
    }
  ]
}
合并的事件
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "identityMap",
      "sourceExpression": "to_map(\"LavaId\",to_array(false,to_object(\"id\",lavaId,\"primary\",true)))",
      "sourceType": "EXPRESSION",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "eventType",
      "sourceAttribute": "type",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "timestamp",
      "sourceAttribute": "timestamp",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventId",
      "sourceAttribute": "eventId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventName",
      "sourceAttribute": "eventName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventLabel",
      "sourceAttribute": "eventLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.venue",
      "sourceAttribute": "venue",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.venueLabel",
      "sourceAttribute": "venueLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.section",
      "sourceAttribute": "section",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.sectionLabel",
      "sourceAttribute": "sectionLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.row",
      "sourceAttribute": "row",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.seat",
      "sourceAttribute": "seat",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.gate",
      "sourceAttribute": "gate",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.gateLabel",
      "sourceAttribute": "gateLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.transactionId",
      "sourceAttribute": "transactionId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.referenceId",
      "sourceAttribute": "referenceId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.subtotal",
      "sourceAttribute": "subtotal",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.total",
      "sourceAttribute": "total",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.location",
      "sourceAttribute": "location",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.items",
      "sourceAttribute": "items",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.redeemedAmount",
      "sourceAttribute": "redeemedAmount",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.rewardsApplied",
      "sourceAttribute": "rewardsApplied",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.amount",
      "sourceAttribute": "amount",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.expiresAt",
      "sourceAttribute": "expiresAt",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardId",
      "sourceAttribute": "rewardId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardName",
      "sourceAttribute": "rewardName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardSlug",
      "sourceAttribute": "rewardSlug",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardType",
      "sourceAttribute": "rewardType",
      "identity": false,
      "version": 0
    }
  ]
}
票证扫描事件
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "identityMap",
      "sourceExpression": "to_map(\"LavaId\",to_array(false,to_object(\"id\",lavaId,\"primary\",true)))",
      "sourceType": "EXPRESSION",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventId",
      "sourceAttribute": "eventId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventName",
      "sourceAttribute": "eventName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.eventLabel",
      "sourceAttribute": "eventLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.venue",
      "sourceAttribute": "venue",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.venueLabel",
      "sourceAttribute": "venueLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.section",
      "sourceAttribute": "section",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.sectionLabel",
      "sourceAttribute": "sectionLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.row",
      "sourceAttribute": "row",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.seat",
      "sourceAttribute": "seat",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.gate",
      "sourceAttribute": "gate",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ticketScan.gateLabel",
      "sourceAttribute": "gateLabel",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "eventType",
      "sourceAttribute": "type",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "timestamp",
      "sourceAttribute": "timestamp",
      "identity": false,
      "version": 0
    }
  ]
}
交易事件
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "identityMap",
      "sourceExpression": "to_map(\"LavaId\",to_array(false,to_object(\"id\",lavaId,\"primary\",true)))",
      "sourceType": "EXPRESSION",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.transactionId",
      "sourceAttribute": "transactionId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.referenceId",
      "sourceAttribute": "referenceId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.subtotal",
      "sourceAttribute": "subtotal",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.total",
      "sourceAttribute": "total",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.location",
      "sourceAttribute": "location",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.items",
      "sourceAttribute": "items",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.redeemedAmount",
      "sourceAttribute": "redeemedAmount",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.transaction.rewardsApplied",
      "sourceAttribute": "rewardsApplied",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "eventType",
      "sourceAttribute": "type",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "timestamp",
      "sourceAttribute": "timestamp",
      "identity": false,
      "version": 0
    }
  ]
}
分类帐事件
code language-json
{
  "version": 0,
  "xdmSchema": "{TARGET_XDM_SCHEMA}",
  "xdmVersion": "1.0",
  "mappings": [
    {
      "destinationXdmPath": "identityMap",
      "sourceExpression": "to_map(\"LavaId\",to_array(false,to_object(\"id\",lavaId,\"primary\",true)))",
      "sourceType": "EXPRESSION",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.amount",
      "sourceAttribute": "amount",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.expiresAt",
      "sourceAttribute": "expiresAt",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardId",
      "sourceAttribute": "rewardId",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardName",
      "sourceAttribute": "rewardName",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardSlug",
      "sourceAttribute": "rewardSlug",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "_{TENANT_ID}.ledger.rewardType",
      "sourceAttribute": "rewardType",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "eventType",
      "sourceAttribute": "type",
      "identity": false,
      "version": 0
    },
    {
      "destinationXdmPath": "timestamp",
      "sourceAttribute": "timestamp",
      "identity": false,
      "version": 0
    }
  ]
}

API格式

POST /conversion/mappingSets

请求

curl -X POST \
  'https://platform.adobe.io/data/foundation/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": "{TARGET_XDM_SCHEMA}",
      "xdmVersion": "1.0",
      "mappings": [
          {
              "destinationXdmPath": "_{TENANT_ID}.lavaId",
              "sourceAttribute": "lavaId",
              "identity": false,
              "version": 0
          },
          {
              "destinationXdmPath": "_{TENANT_ID}.balances",
              "sourceAttribute": "balances",
              "identity": false,
              "version": 0
          }
      ]
  }'
属性
描述
xdmSchema
在之前的步骤中生成的目标XDM架构的ID。
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}"
}

创建流 flow

将数据从LAVA引入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": "Streaming Dataflow for a Streaming SDK source",
      "description": "Streaming Dataflow for a Streaming SDK source",
      "flowSpec": {
          "id": "e77fde5a-22a8-11ed-861d-0242ac120002",
          "version": "1.0"
      },
      "sourceConnectionIds": [
          "246d052c-da4a-494a-937f-a0d17b1c6cf5"
      ],
      "targetConnectionIds": [
          "7c96c827-3ffd-460c-a573-e9558f72f263"
      ],
      "transformations": [
      {
        "name": "Mapping",
        "params": {
          "mappingId": "bf5286a9c1ad4266baca76ba3adc9366",
          "mappingVersion": 0
        }
      }
    ]
  }'
属性
描述
name
您的数据流的名称。 确保数据流的名称是描述性的,因为您可以使用此名称查找数据流上的信息。
description
可包含的可选值,用于提供有关数据流的更多信息。
flowSpec.id
创建数据流所需的流规范ID。 此固定ID为: e77fde5a-22a8-11ed-861d-0242ac120002
flowSpec.version
流规范ID的相应版本。 此值默认为1.0
sourceConnectionIds
在之前的步骤中生成的源连接ID
targetConnectionIds
在之前的步骤中生成的目标连接ID
transformations
此属性包含需要应用于数据的各种转换。 将不符合XDM的数据引入Experience Platform时,需要此属性。
transformations.name
分配给转换的名称。
transformations.params.mappingId
在之前的步骤中生成的映射ID
transformations.params.mappingVersion
映射ID的相应版本。 此值默认为0

响应

成功的响应返回新创建的数据流的ID (id)。 您可以使用此ID监视、更新或删除数据流。

{
     "id": "993f908f-3342-4d9c-9f3c-5aa9a189ca1a",
     "etag": "\"510bb1d4-8453-4034-b991-ab942e11dd8a\""
}

获取您的流端点URL

创建数据流后,您现在可以检索流端点URL。 您将使用此端点URL将源订阅到webhook,从而允许源与Experience Platform通信。

要检索您的流端点URL,请对/flows端点发出GET请求并提供您的数据流的ID。

API格式

GET /flows/{FLOW_ID}

请求

curl -X GET \
  'https://platform.adobe.io/data/foundation/flowservice/flows/993f908f-3342-4d9c-9f3c-5aa9a189ca1a' \
  -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的终结点URL。

{
  "items": [
    {
      "id": "993f908f-3342-4d9c-9f3c-5aa9a189ca1a",
      "createdAt": 1669238699119,
      "updatedAt": 1669238699119,
      "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 a Streaming SDK source",
      "description": "Streaming Dataflow for a Streaming SDK source",
      "flowSpec": {
        "id": "e77fde5a-22a8-11ed-861d-0242ac120002",
        "version": "1.0"
      },
      "state": "enabled",
      "version": "\"a1011225-0000-0200-0000-63c78ae60000\"",
      "etag": "\"a1011225-0000-0200-0000-63c78ae60000\"",
      "sourceConnectionIds": [
        "246d052c-da4a-494a-937f-a0d17b1c6cf5"
      ],
      "targetConnectionIds": [
        "7c96c827-3ffd-460c-a573-e9558f72f263"
      ],
      "inheritedAttributes": {
        "properties": {
          "isSourceFlow": true
        },
        "sourceConnections": [
          {
            "id": "246d052c-da4a-494a-937f-a0d17b1c6cf5",
            "connectionSpec": {
              "id": "bdb5b792-451b-42de-acf8-15f3195821de",
              "version": "1.0"
            }
          }
        ],
        "targetConnections": [
          {
            "id": "7c96c827-3ffd-460c-a573-e9558f72f263",
            "connectionSpec": {
              "id": "c604ff05-7f1a-43c0-8e18-33bf874cb11c",
              "version": "1.0"
            }
          }
        ]
      },
      "options": {
        "errorDiagnosticsEnabled": true,
        "inletUrl": "https://dcs-int.adobedc.net/collection/ab65636c31778fb0455c439ffb48a5433a34d443f4c83c4b5beda9c5688797c5"
      },
      "transformations": [
        {
          "name": "Mapping",
          "params": {
            "mappingVersion": 0,
            "mappingId": "bf5286a9c1ad4266baca76ba3adc9366"
          }
        }
      ],
      "runs": "/runs?property=flowId==e1514b79-f031-43b4-aab5-381a42f86ad4",
      "providerRefId": "c9809ab5-71e0-4c7f-887b-61c95e4e20b5",
      "lastOperation": {
        "started": 0,
        "updated": 0,
        "operation": "enable"
      }
    }
  ]
}

将LAVA与您的webhook集成

LAVA控制台中,导航到​Resources > Data Export

LAVA控制台中“数据导出”菜单屏幕截图

选择 Create New Export。 选择​ Adobe Source Connector ​作为目标类型,并选择要发送的所需源数据。 使用流端点URL和数据流ID。

LAVA控制台中“新建导出”屏幕截图

附录

以下部分提供了有关监视、更新和删除数据流可以采取的步骤的信息。

监测数据流

创建数据流后,您可以监视通过它摄取的数据,以查看有关流运行、完成状态和错误的信息。 有关完整的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🔗删除源帐户的指南。

recommendation-more-help
experience-platform-help-sources