使用Destination SDK创建的目标模板规范

使用目标服务器配置的模板规范部分配置如何格式化发送到目标的HTTP请求。

在模板规范中,您可以定义如何在XDM架构和平台支持的格式之间转换配置文件属性字段。

模板规范是实时(流)目标的目标服务器配置的一部分。

要了解此组件在何处适合使用Destination SDK创建的集成,请参阅中的图表 配置选项 文档或参阅指南,了解如何 使用Destination SDK配置流目标.

您可以通过以下方式配置目标的模板规范 /authoring/destination-servers 端点。 有关详细的API调用示例,请参阅以下API参考页面,您可以在其中配置此页面中显示的组件。

重要

Destination SDK支持的所有参数名称和值包括 区分大小写. 为避免出现区分大小写错误,请完全按照文档中的说明使用参数名称和值。

支持的集成类型

有关哪些类型的集成支持此页面上描述的功能,请参阅下表。

集成类型 支持功能
实时(流)集成
基于文件(批处理)的集成

配置模板规范

Adobe使用类似于的模板语言 金贾 将XDM架构中的字段转换为目标支持的格式。

突出显示的模板配置

有关转换的更多信息,请访问以下链接:

小贴士

Adobe选件 开发人员工具 以帮助您创建和测试消息转换模板。

请参阅下面的HTTP请求模板示例,以及每个参数的说明。

{
   "httpTemplate":{
      "httpMethod":"POST",
      "requestBody":{
         "templatingStrategy":"PEBBLE_V1",
         "value":"{ \"attributes\": [ {% for ns in [\"external_id\", \"yourdestination_id\"] %} {% if input.profile.identityMap[ns] is not empty and first_namespace_encountered %} , {% endif %} {% set first_namespace_encountered = true %} {% for identity in input.profile.identityMap[ns]%} { \"{{ ns }}\": \"{{ identity.id }}\" {% if input.profile.segmentMembership.ups is not empty %} , \"AEPSegments\": { \"add\": [ {% for segment in input.profile.segmentMembership.ups %} {% if segment.value.status == \"realized\" or segment.value.status == \"existing\" %} {% if added_segment_found %} , {% endif %} {% set added_segment_found = true %} \"{{ destination.segmentAliases[segment.key] }}\" {% endif %} {% endfor %} ], \"remove\": [ {% for segment in input.profile.segmentMembership.ups %} {% if segment.value.status == \"exited\" %} {% if removed_segment_found %} , {% endif %} {% set removed_segment_found = true %} \"{{ destination.segmentAliases[segment.key] }}\" {% endif %} {% endfor %} ] } {% set removed_segment_found = false %} {% set added_segment_found = false %} {% endif %} {% if input.profile.attributes is not empty %} , {% endif %} {% for attribute in input.profile.attributes %} \"{{ attribute.key }}\": {% if attribute.value is empty %} null {% else %} \"{{ attribute.value.value }}\" {% endif %} {% if not loop.last%} , {% endif %} {% endfor %} } {% if not loop.last %} , {% endif %} {% endfor %} {% endfor %} ] }"
      },
      "contentType":"application/json"
   }
}
参数 类型 描述
httpMethod 字符串 必需。 Adobe将在对服务器的调用中使用的方法。 支持的方法: GETPUTPOSTDELETEPATCH.
templatingStrategy 字符串 必需。​使用 PEBBLE_V1
value 字符串 必需。 此字符串是模板的字符转义版本,用于将Platform发送的HTTP请求格式化为目标所需的格式。
有关如何编写模板的信息,请阅读以下部分: 使用模板.
有关字符转义的详细信息,请参阅 RFC JSON标准,第七节.
有关简单转换的示例,请参阅 配置文件属性 转换。
contentType 字符串 必需。 您的服务器接受的内容类型。 根据转换模板生成的输出类型,这可以是任何受支持的输出 HTTP应用程序内容类型. 在大多数情况下,此值应设置为 application/json.

后续步骤

阅读本文后,您应该更好地了解什么是模板规范以及如何对其进行配置。

要了解有关其他目标服务器组件的更多信息,请参阅以下文章:

在此页面上