使用預先定義的檔案格式選項和自訂檔案名稱設定來設定SFTP目的地

概觀 overview

本頁面說明如何使用Destination SDK來設定具有預先定義預設值的SFTP目的地 檔案格式選項 以及自訂 檔案名稱組態.

此頁面顯示SFTP目的地可用的所有設定選項。 您可以編輯下列步驟中顯示的組態,或視需要刪除組態的特定部分。

如需底下所用引數的詳細說明,請參閱 目的地SDK中的設定選項.

先決條件 prerequisites

在繼續進行以下步驟之前,請閱讀 Destination SDK快速入門 頁面以取得必要的Adobe I/O驗證認證,以及使用Destination SDKAPI的其他必要條件。

步驟1:建立伺服器和檔案組態 create-server-file-configuration

首先,使用 /destination-server 端點至 建立伺服器和檔案組態.

API格式

POST platform.adobe.io/data/core/activation/authoring/destination-servers

要求

以下請求會建立新的目的地伺服器組態,由承載中提供的引數設定。
以下承載包含一般SFTP設定,具有預先定義的預設值 CSV檔案格式 使用者可在Experience PlatformUI中定義的設定引數。

curl -X POST https://platform.adobe.io/data/core/activation/authoring/destination-server \
 -H 'Authorization: Bearer {ACCESS_TOKEN}' \
 -H 'Content-Type: application/json' \
 -H 'x-gw-ims-org-id: {ORG_ID}' \
 -H 'x-api-key: {API_KEY}' \
 -H 'x-sandbox-name: {SANDBOX_NAME}' \
 -d '
{
    "name": "SFTP destination with predefined CSV formatting options",
    "destinationServerType": "FILE_BASED_SFTP",
    "fileBasedSFTPDestination": {
        "hostname": {
            "templatingStrategy": "NONE",
            "value": "{{customerData.hostname}}"
        },
        "rootDirectory": {
            "templatingStrategy": "PEBBLE_V1",
            "value": "{{customerData.remotePath}}"
        },
        "port": 22
    },
    "fileConfigurations": {
        "compression": {
            "templatingStrategy": "PEBBLE_V1",
            "value": "{{customerData.compression}}"
        },
        "fileType": {
            "templatingStrategy": "PEBBLE_V1",
            "value": "{{customerData.fileType}}"
        },
        "csvOptions": {
            "quote": {
                "templatingStrategy": "NONE",
                "value": "\""
            },
            "quoteAll": {
                "templatingStrategy": "NONE",
                "value": "false"
            },
            "escape": {
                "templatingStrategy": "NONE",
                "value": "\\"
            },
            "escapeQuotes": {
                "templatingStrategy": "NONE",
                "value": "true"
            },
            "header": {
                "templatingStrategy": "NONE",
                "value": "true"
            },
            "ignoreLeadingWhiteSpace": {
                "templatingStrategy": "NONE",
                "value": "true"
            },
            "ignoreTrailingWhiteSpace": {
                "templatingStrategy": "NONE",
                "value": "true"
            },
            "nullValue": {
                "templatingStrategy": "NONE",
                "value": ""
            },
            "dateFormat": {
                "templatingStrategy": "NONE",
                "value": "yyyy-MM-dd"
            },
            "timestampFormat": {
                "templatingStrategy": "NONE",
                "value": "yyyy-MM-dd'T':mm:ss[.SSS][XXX]"
            },
            "charToEscapeQuoteEscaping": {
                "templatingStrategy": "NONE",
                "value": "\\"
            },
            "emptyValue": {
                "templatingStrategy": "NONE",
                "value": ""
            }
        }
    }
}'

成功的回應會傳回新的目的地伺服器設定,包括唯一識別碼(instanceId)。 將此值儲存為下一個步驟所需的值。

步驟2:建立目的地設定 create-destination-configuration

在上一步中建立目的地伺服器和檔案格式設定後,您現在可以使用 /destinations API端點以建立目的地設定。

若要在中連線伺服器組態 步驟1 對於此目的地設定,將 destinationServerId API要求中的值,連同在中建立您的目的地伺服器時取得的值 步驟1.

API格式

POST platform.adobe.io/data/core/activation/authoring/destinations

要求

curl -X POST https://platform.adobe.io/data/core/activation/authoring/destinations \
 -H 'Authorization: Bearer {ACCESS_TOKEN}' \
 -H 'Content-Type: application/json' \
 -H 'x-gw-ims-org-id: {ORG_ID}' \
 -H 'x-api-key: {API_KEY}' \
 -H 'x-sandbox-name: {SANDBOX_NAME}' \
 -d '
{
   "name":"SFTP destination with predefined CSV formatting options",
   "description":"SFTP destination with predefined CSV formatting options",
   "status":"TEST",
   "customerAuthenticationConfigurations":[
      {
         "authType":"SFTP_WITH_PASSWORD"
      },
      {
         "authType":"SFTP_WITH_SSH_KEY"
      }
   ],
   "customerEncryptionConfigurations":[

   ],
   "customerDataFields":[
      {
         "name":"remotePath",
         "title":"Root directory",
         "description":"Enter root directory",
         "type":"string",
         "isRequired":true,
         "readOnly":false,
         "hidden":false
      },
      {
         "name":"hostname",
         "title":"Hostname",
         "description":"Enter hostname",
         "type":"string",
         "isRequired":true,
         "readOnly":false,
         "hidden":false
      }
   ],
   "uiAttributes":{
      "documentationLink":"https://www.adobe.com/go/destinations-sftp-en",
      "category":"SFTP",
      "connectionType":"SFTP",
      "monitoringSupported":true,
      "flowRunsSupported":true,
      "frequency":"Batch"
   },
   "destinationDelivery":[
      {
         "deliveryMatchers":[
            {
               "type":"SOURCE",
               "value":[
                  "batch"
               ]
            }
         ],
         "authenticationRule":"CUSTOMER_AUTHENTICATION",
         "destinationServerId":"{{instanceID of your destination server}}"
      }
   ],
   "schemaConfig":{
      "profileRequired":true,
      "segmentRequired":true,
      "identityRequired":true
   },
   "batchConfig":{
      "allowMandatoryFieldSelection":true,
      "allowDedupeKeyFieldSelection":true,
      "defaultExportMode":"DAILY_FULL_EXPORT",
      "allowedExportMode":[
         "DAILY_FULL_EXPORT",
         "FIRST_FULL_THEN_INCREMENTAL"
      ],
      "allowedScheduleFrequency":[
         "DAILY",
         "EVERY_3_HOURS",
         "EVERY_6_HOURS",
         "EVERY_8_HOURS",
         "EVERY_12_HOURS",
         "ONCE"
      ],
      "defaultFrequency":"DAILY",
      "defaultStartTime":"00:00",
      "filenameConfig":{
         "allowedFilenameAppendOptions":[
            "SEGMENT_NAME",
            "DESTINATION_INSTANCE_ID",
            "DESTINATION_INSTANCE_NAME",
            "ORGANIZATION_NAME",
            "SANDBOX_NAME",
            "DATETIME",
            "CUSTOM_TEXT"
         ],
         "defaultFilenameAppendOptions":[
            "DATETIME"
         ],
         "defaultFilename":"%DESTINATION%_%SEGMENT_ID%"
      },
      "backfillHistoricalProfileData":true
   }
}'

成功的回應會傳回新的目的地設定,包括唯一識別碼(instanceId)。 如果您需要進一步提出HTTP請求來更新您的目的地設定,請視需要儲存此值。

步驟3:驗證Experience PlatformUI verify-ui

根據上述設定,Experience Platform目錄現在會顯示新的私人目的地卡供您使用。

熒幕錄製,顯示具有已選取目的地卡片的目的地目錄頁面。

在以下影像和錄製中,請注意中的選項 檔案型目的地的啟用工作流程 符合您在目的地設定中選取的選項。

填寫目的地的詳細資料時,請注意顯示的欄位是您在設定中設定的自訂資料欄位。

TIP
您新增自訂資料欄位至目的地設定的順序不會反映在UI中。 自訂資料欄位一律以下方熒幕錄製中顯示的順序顯示。

填寫目的地詳細資料

排程匯出間隔時,請注意顯示的欄位是您在 batchConfig 設定。
匯出排程選項

檢視檔案名稱組態選項時,請注意顯示的欄位如何表示 filenameConfig 您在設定中設定的選項。
檔案名稱組態選項

如果您要調整任何上述欄位,請重複 步驟一兩個 以根據您的需求修改設定。

步驟4: (選用)發佈您的目的地 publish-destination

NOTE
如果您要建立供自己使用的私人目的地,且不想將其發佈到目的地目錄以供其他客戶使用,則不需要執行此步驟。

設定目的地後,請使用 目的地發佈API 將您的設定提交給Adobe進行檢閱。

步驟5: (選用)記錄您的目的地 document-destination

NOTE
如果您要建立供自己使用的私人目的地,且不想將其發佈到目的地目錄以供其他客戶使用,則不需要執行此步驟。

如果您是獨立軟體廠商(ISV)或系統整合商(SI),請建立 產品化整合,使用 自助服務檔案程式 若要在中建立您目的地的產品檔案頁面 Experience Platform目的地目錄.

後續步驟 next-steps

閱讀本文章,您現在瞭解如何使用Destination SDK編寫自訂SFTP目的地。 接下來,您的團隊可以使用 檔案型目的地的啟用工作流程 將資料匯出至目的地。

recommendation-more-help
7f4d1967-bf93-4dba-9789-bb6b505339d6