使用 Flow Service API

Flow Service 用于收集和集中Adobe Experience Platform内不同来源的客户数据。 该服务提供了用户界面和RESTful API,所有受支持的源都可从中连接。

本教程使用 Flow Service 用于探索第三方的API 电子商务 连接。

快速入门

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

  • Sources: Experience Platform 允许从各种源摄取数据,同时让您能够使用来构建、标记和增强传入数据 Platform 服务。
  • Sandboxes: Experience Platform 提供分区单个沙箱的虚拟沙箱 Platform 实例迁移到单独的虚拟环境中,以帮助开发和改进数字体验应用程序。

以下部分提供了成功连接到 电子商务 使用 Flow Service API。

获取连接ID

为了探索 电子商务 连接使用 Platform API,您必须拥有有效的连接ID。 如果尚未连接 电子商务 要与之建立连接,您可以通过以下教程创建一个连接:

读取示例API调用

本教程提供了用于演示如何设置请求格式的示例API调用。 这包括路径、所需标头以及格式正确的请求负载。 还提供了API响应中返回的示例JSON。 有关示例API调用文档中使用的约定的信息,请参阅 如何阅读示例API调用 在 Experience Platform 疑难解答指南。

收集所需标题的值

为了调用 Platform API,您必须先完成 身份验证教程. 完成身份验证教程将为所有中每个所需标头提供值 Experience Platform API调用,如下所示:

  • Authorization: Bearer {ACCESS_TOKEN}
  • x-api-key: {API_KEY}
  • x-gw-ims-org-id: {ORG_ID}

中的所有资源 Experience Platform,包括属于 Flow Service,与特定虚拟沙箱隔离。 对 Platform API需要一个标头来指定操作将在其中执行的沙盒的名称:

  • x-sandbox-name: {SANDBOX_NAME}

所有包含有效负载(POST、PUT、PATCH)的请求都需要额外的媒体类型标头:

  • Content-Type: application/json

浏览数据表

使用 电子商务 连接ID中,您可以通过执行GET请求来浏览数据表。 使用以下调用查找要检查或摄取到的表的路径 Platform.

API格式

GET /connections/{CONNECTION_ID}/explore?objectType=root
参数 描述
{CONNECTION_ID} 您的 电子商务 连接ID。

请求

curl -X GET \
    'http://platform.adobe.io/data/foundation/flowservice/connections/582f4f8d-71e9-4a5c-a164-9d2056318d6c/explore?objectType=root' \
    -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}'

响应

成功的响应会从 电子商务 连接。 找你想进去的桌子 Platform 并注意 path 资产,因为您需要在下一步中提供该资产以检查其结构。

[
    {
        "type": "table",
        "name": "Shopify.Abandoned_Checkout_Discount_Codes",
        "path": "Shopify.Abandoned_Checkout_Discount_Codes",
        "canPreview": true,
        "canFetchSchema": true
    },
    {
        "type": "table",
        "name": "Shopify.Abandoned_Checkout_Line_Items",
        "path": "Shopify.Abandoned_Checkout_Line_Items",
        "canPreview": true,
        "canFetchSchema": true
    },
    {
        "type": "table",
        "name": "Shopify.Blogs",
        "path": "Shopify.Blogs",
        "canPreview": true,
        "canFetchSchema": true
    },
    {
        "type": "table",
        "name": "Shopify.Orders",
        "path": "Shopify.Orders",
        "canPreview": true,
        "canFetchSchema": true
    }
]

Inspect表的结构

电子商务 连接时,执行GET请求,同时指定 object 查询参数。

API格式

GET /connections/{CONNECTION_ID}/explore?objectType=table&object={TABLE_PATH}
参数 描述
{CONNECTION_ID} 您的 电子商务 连接。
{TABLE_PATH} 表在 电子商务 连接。

请求

curl -X GET \
    'http://platform.adobe.io/data/foundation/flowservice/connections/582f4f8d-71e9-4a5c-a164-9d2056318d6c/explore?objectType=table&object=Orders' \
    -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}'

响应

成功的响应会返回指定表的结构。 有关每个表列的详细信息位于 columns 数组。

{
    "format": "flat",
    "schema": {
        "columns": [
            {
                "name": "Blog_Id",
                "type": "double",
                "xdm": {
                    "type": "number"
                }
            },
            {
                "name": "Title",
                "type": "string",
                "xdm": {
                    "type": "string"
                }
            },
            {
                "name": "Created_At",
                "type": "string",
                "meta:xdmType": "date-time",
                "xdm": {
                    "type": "string",
                    "format": "date-time"
                }
            },
            {
                "name": "Tags",
                "type": "string",
                "xdm": {
                    "type": "string"
                }
            }
        ]
    },
    "data": [
        {
            "Updated_At": "2020-11-05T10:54:36",
            "Title": "News",
            "Commentable": "no",
            "Blog_Id": 5.5458332804E10,
            "Handle": "news",
            "Created_At": "2020-02-14T09:11:15"
        }
    ]
}

后续步骤

通过阅读本教程,您已 电子商务 连接,找到要摄取到的表的路径 Platform,并获取了有关其结构的信息。 在下一个教程中,您可以在 收集电子商务数据并将其导入平台.

在此页面上