使用预定义的文件格式选项和自定义文件名配置来配置SFTP目标
概述 overview
本页介绍如何使用Destination SDK配置具有预定义的默认文件格式选项和自定义文件名配置的SFTP目标。
此页面显示SFTP目标可用的所有配置选项。 您可以根据需要编辑以下步骤中显示的配置或删除配置的某些部分。
有关下面使用的参数的详细说明,请参阅目标SDK 🔗中的配置选项。
先决条件 prerequisites
在进入下面列出的步骤之前,请阅读Destination SDK快速入门页面,了解有关获取使用Destination SDKAPI所必需的Adobe I/O身份验证凭据和其他先决条件的信息。
步骤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中的服务器配置连接到此目标配置,请将以下API请求中的destinationServerId值替换为在步骤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目录现在将显示新的专用目标卡以供您使用。
在下面的图像和录制中,请注意基于文件的目标的激活工作流中的选项如何与您在目标配置中选择的选项相匹配。
在填写有关目标的详细信息时,请注意显示的字段是您在配置中设置的自定义数据字段。
在计划导出间隔时,请注意显示的字段是您在batchConfig配置中设置的字段。
查看文件名配置选项时,请注意显示的字段如何表示您在配置中设置的filenameConfig选项。
如果要调整上述任何字段,请重复步骤1和步骤2以根据需要修改配置。
步骤4:(可选)Publish您的目标 publish-destination
配置目标后,使用目标发布API将配置提交给Adobe进行审核。
步骤5:(可选)记录您的目标 document-destination
如果您是创建产品化集成的独立软件供应商(ISV)或系统集成商(SI),请使用自助文档流程在Experience Platform目标目录中为您的目标创建产品文档页面。
后续步骤 next-steps
通过阅读本文,您现在知道如何使用Destination SDK创作自定义SFTP目标。 接下来,您的团队可以使用基于文件的目标的激活工作流将数据导出到目标。