建立基礎連線

基本連線會保留來源與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連線規格識別碼: 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連線規格識別碼: 74a1c565-4e59-48d7-9d67-7c03b8a13137

回應

成功的回應會傳回新建立之基礎連線的唯一識別碼(id)。

檢視回應範例
{
    "id": "2c15b1c5-73bf-47ab-9098-0467fcd854d9",
    "etag": "\"2600fc39-0000-0200-0000-67dd48f80000\""
}