创建基本连接

基本连接会保留源与Experience Platform之间的信息,包括源的身份验证凭据、连接的当前状态以及唯一的基本连接ID。 基本连接ID允许您浏览和浏览源中的文件,并标识要摄取的特定项目,包括有关其数据类型和格式的信息。

要创建基本连接ID,请在提供您的PostgreSQL身份验证凭据作为请求参数的一部分时,向/connections端点发出POST请求。

API格式

POST /connections

请求

以下请求使用基于帐户密钥的身份验证为PostgreSQL创建基本连接:

查看请求示例
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": "PostgreSQL base connection",
      "description": "PostgreSQL base connection via connection string",
      "auth": {
          "specName": "Connection String Based Authentication",
          "params": {
              "connectionString": "Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD}"
          }
      },
      "connectionSpec": {
          "id": "74a1c565-4e59-48d7-9d67-7c03b8a13137",
          "version": "1.0"
      }
  }'
属性描述
auth.params.connectionString与您的PostgreSQL帐户关联的连接字符串。 PostgreSQL连接字符串模式为: Server={SERVER};Database={DATABASE};Port={PORT};UID={USERNAME};Password={PASSWORD}
connectionSpec.idPostgreSQL连接规范ID: 74a1c565-4e59-48d7-9d67-7c03b8a13137

响应

成功的响应返回新创建的基本连接的唯一标识符(id)。

查看响应示例
{
    "id": "056dd1b4-da33-42f9-add1-b4da3392f94e",
    "etag": "\"1700e582-0000-0200-0000-5e3c85180000\""
}

请求

以下请求使用基本身份验证为PostgreSQL创建基本连接:

查看请求示例
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": "PostgreSQL base connection",
      "description": "PostgreSQL base connection via basic authentication",
      "auth": {
          "specName": "Basic Authentication",
          "params": {
              "server": "localhost",
              "port": "3306",
              "database": "postgresql-acme",
              "username": "acme",
              "password": "xxxx",
              "sslMode": "Allow"
          }
      },
      "connectionSpec": {
          "id": "74a1c565-4e59-48d7-9d67-7c03b8a13137",
          "version": "1.0"
      }
  }'
属性描述
auth.params.serverPostgreSQL数据库的名称或IP地址。
auth.params.port数据库服务器的端口号。
auth.params.databasePostgreSQL数据库的名称。
auth.params.username与您的PostgreSQL数据库身份验证关联的用户名。
auth.params.password与您的PostgreSQL数据库身份验证关联的密码。
auth.params.sslMode在数据传输期间对数据进行加密的方法。 可用值包括: DisableAllowPreferVerify CaVerify Full
connectionSpec.idPostgreSQL连接规范ID: 74a1c565-4e59-48d7-9d67-7c03b8a13137

响应

成功的响应返回新创建的基本连接的唯一标识符(id)。

查看响应示例
{
    "id": "2c15b1c5-73bf-47ab-9098-0467fcd854d9",
    "etag": "\"2600fc39-0000-0200-0000-67dd48f80000\""
}