Generate a sample message transformation template get-sample-template-api-operations
https://platform.adobe.io/data/core/activation/authoring/testing/template/sample
This page lists and describes all the API operations that you can perform using the /authoring/testing/template/sample
API endpoint, to generate a message transformation template for your destination. For a description of the functionality supported by this endpoint, read create template.
Getting started with sample template API operations get-started
Before continuing, please review the getting started guide for important information that you need to know in order to successfully make calls to the API, including how to obtain the required destination authoring permission and required headers.
Get sample template generate-sample-template
You can get a sample template by making a GET request to the authoring/testing/template/sample/
endpoint and providing the destination ID of the destination configuration based on which you are creating your template.
- The destination ID that you should use here is the
instanceId
that corresponds to a destination configuration, created using the/destinations
endpoint. Refer to the retrieve a destination configuration for more details.
API format
GET authoring/testing/template/sample/{DESTINATION_ID}
{DESTINATION_ID}
Request
The following request generates a new sample template, configured by the parameters provided in the payload.
curl --location --request GET 'https://platform.adobe.io/data/core/activation/authoring/testing/template/sample/5114d758-ce71-43ba-b53e-e2a91d67b67f' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-api-key: {API_KEY}' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'x-gw-ims-org-id: {ORG_ID}' \
--header 'x-sandbox-name: {SANDBOX_NAME}' \
Response
A successful response returns HTTP status 200 with a sample template that you can edit to match your expected data format.
If the destination ID you provide corresponds to a destination configuration with best effort aggregation and maxUsersPerRequest=1
in the aggregation policy, the request returns a sample template similar to this one:
{#- THIS is an example template for a single profile -#}
{#- A '-' at the beginning or end of a tag removes all whitespace on that side of the tag. -#}
{
"identities": [
{%- for idMapEntry in input.profile.identityMap -%}
{%- set namespace = idMapEntry.key -%}
{%- for identity in idMapEntry.value %}
{
"type": "{{ namespace }}",
"id": "{{ identity.id }}"
}{%- if not loop.last -%},{%- endif -%}
{%- endfor -%}{%- if not loop.last -%},{%- endif -%}
{% endfor %}
],
"AdobeExperiencePlatformSegments": {
"add": [
{%- for segment in input.profile.segmentMembership.ups | added %}
"{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
{% endfor %}
],
"remove": [
{#- Alternative syntax for filtering audiences by status: -#}
{% for segment in removedSegments(input.profile.segmentMembership.ups) %}
"{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
{% endfor %}
]
}
}
If the destination ID you provide corresponds to a destination server template with configurable aggregation or best effort aggregation with maxUsersPerRequest
greater than one, the request returns a sample template similar to this one:
{#- THIS is an example template for multiple profiles -#}
{#- A '-' at the beginning or end of a tag removes all whitespace on that side of the tag. -#}
{
"profiles": [
{%- for profile in input.profiles %}
{
"identities": [
{%- for idMapEntry in profile.identityMap -%}
{%- set namespace = idMapEntry.key -%}
{%- for identity in idMapEntry.value %}
{
"type": "{{ namespace }}",
"id": "{{ identity.id }}"
}{%- if not loop.last -%},{%- endif -%}
{%- endfor -%}{%- if not loop.last -%},{%- endif -%}
{% endfor %}
],
"AdobeExperiencePlatformSegments": {
"add": [
{%- for segment in profile.segmentMembership.ups | added %}
"{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
{% endfor %}
],
"remove": [
{#- Alternative syntax for filtering audiences by status: -#}
{% for segment in removedSegments(profile.segmentMembership.ups) %}
"{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
{% endfor %}
]
}
}{%- if not loop.last -%},{%- endif -%}
{% endfor %}
]
}
API error handling api-error-handling
Destination SDK API endpoints follow the general Experience Platform API error message principles. Refer to API status codes and request header errors in the Platform troubleshooting guide.
Next steps next-steps
After reading this document, you now know how to generate a message transformation template using the /authoring/testing/template/sample
API endpoint. Next, you can use the Render template API endpoint to generate exported profiles based on the template and compare them against your destination’s expected data format.