使用Flow Service API浏览数据库

本教程使用Flow Service API来浏览第三方数据库的内容和文件结构。

快速入门

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

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

以下部分提供了使用Flow Service API成功连接到第三方数据库所需了解的其他信息。

使用Experience Platform API

有关如何成功调用Experience Platform API的信息,请参阅Experience Platform API快速入门指南。

浏览您的数据表

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

API格式

GET /connections/{BASE_CONNECTION_ID}/explore?objectType=root
参数
描述
{BASE_CONNECTION_ID}
数据库源的连接ID。

请求

curl -X GET \
    'https://platform.adobe.io/data/foundation/flowservice/connections/6990abad-977d-41b9-a85d-17ea8cf1c0e4/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}'

响应

成功的响应会从数据库中返回表数组。 查找要带入Experience Platform的表并记下其path属性,因为在下一步中需要提供该表以检查其结构。

[
    {
        "type": "table",
        "name": "test1.Mytable",
        "path": "test1.Mytable",
        "canPreview": true,
        "canFetchSchema": true
    },
    {
        "type": "table",
        "name": "test1.austin_demo",
        "path": "test1.austin_demo",
        "canPreview": true,
        "canFetchSchema": true
    }
]

检查表的结构

要从数据库中检查表的结构,请在将表的路径指定为查询参数时执行GET请求。

API格式

GET /connections/{BASE_CONNECTION_ID}/explore?objectType=table&object={TABLE_PATH}
参数
描述
{BASE_CONNECTION_ID}
数据库连接的ID。
{TABLE_PATH}
表的路径。

请求

curl -X GET \
    'https://platform.adobe.io/data/foundation/flowservice/connections/6990abad-977d-41b9-a85d-17ea8cf1c0e4/explore?objectType=table&object=test1.Mytable' \
    -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": "TestID",
                "type": "string",
                "xdm": {
                    "type": "string"
                }
            },
            {
                "name": "Name",
                "type": "string",
                "xdm": {
                    "type": "string"
                }
            }
        ]
    },
    "data": [],
    "cdcMetadata": {
      "columnDetected": true
    }
}

后续步骤

通过阅读本教程,您已浏览数据库,找到要摄取到Experience Platform中的表的路径,并获得了有关其结构的信息。 您可以在下一个教程中使用此信息从数据库收集数据并将其导入Experience Platform

recommendation-more-help
337b99bb-92fb-42ae-b6b7-c7042161d089