curl -X POST https://platform.adobe.io/data/core/activation/authoring/audience-templates/{INSTANCE_ID} \
-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 '
{
"metadataTemplate": {
"name": "Test Webhook Audience Template",
"create": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/segments",
"httpMethod": "POST",
"headers": [
{
"value": "application/json",
"header": "Content-Type"
},
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"requestBody": {
"json": {
"name": "{{segment.name}}",
"type": "segment",
"metadata": {
"org_id": "{{destination.imsOrgId}}",
"sandbox": "{{destination.sandboxName}}",
"destination_id": "{{destination.id}}",
"destination_name": "{{destination.name}}",
"segmentEnrichmentAttributes": "{% set columns = [] %}{% for atr in segmentEnrichmentAttributes %}{% set columns = columns|merge([atr.source]) %}{% endfor %}{{ columns | toJson }}"
},
"external_id": "{{segment.id}}"
}
},
"responseFields": [
{
"value": "{{headers.X-Request-Id}}",
"name": "externalAudienceId"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
},
"update": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/segments/{{segment.alias}}",
"httpMethod": "PUT",
"headers": [
{
"value": "application/json",
"header": "Content-Type"
},
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"requestBody": {
"json": {
"name": "{{segment.name}}",
"type": "segment",
"metadata": {
"org_id": "{{destination.imsOrgId}}",
"sandbox": "{{destination.sandboxName}}",
"destination_id": "{{destination.id}}",
"destination_name": "{{destination.name}}",
"segmentEnrichmentAttributes": "{% set columns = [] %}{% for atr in segmentEnrichmentAttributes %}{% set columns = columns|merge([atr.source]) %}{% endfor %}{{ columns | toJson }}"
},
"external_id": "{{segment.id}}"
}
},
"responseFields": [
{
"value": "{{headers.X-Request-Id}}",
"name": "externalAudienceId"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
},
"delete": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/segments/{{segment.alias}}",
"httpMethod": "DELETE",
"headers": [
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
},
"createDestination": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/createDestination",
"httpMethod": "POST",
"headers": [
{
"value": "application/json",
"header": "Content-Type"
},
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"requestBody": {
"json": {
"name": "{{destination.name}}",
"type": "destination",
"metadata": {
"org_id": "{{destination.imsOrgId}}",
"sandbox": "{{destination.sandboxName}}",
"destination_id": "{{destination.id}}",
"destination_name": "{{destination.name}}",
"enrichmentAttributes": "{{destination.enrichmentAttributes}}"
},
"external_id": "{{destination.id}}"
}
},
"responseFields": [
{
"value": "{{headers.X-Request-Id}}",
"name": "externalAudienceId"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
},
"updateDestination": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/updateDestination",
"httpMethod": "POST",
"headers": [
{
"value": "application/json",
"header": "Content-Type"
},
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"requestBody": {
"json": {
"name": "{{destination.name}}",
"type": "destination",
"metadata": {
"org_id": "{{destination.imsOrgId}}",
"sandbox": "{{destination.sandboxName}}",
"destination_id": "{{destination.id}}",
"destination_name": "{{destination.name}}",
"enrichmentAttributes": "{{destination.enrichmentAttributes}}"
},
"external_id": "{{destination.id}}"
}
},
"responseFields": [
{
"value": "{{headers.X-Request-Id}}",
"name": "externalAudienceId"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
},
"deleteDestination": {
"url": "https://your-webhook-site/0bd222fa-8ae2-433b-8f0e-f2ce137b0ee4/{{customerData.customerID}}/deleteDestination",
"httpMethod": "DELETE",
"headers": [
{
"value": "Bearer {{authData.token}}",
"header": "Authorization"
}
],
"responseErrorFields": [
{
"value": "{{root}}",
"name": "message"
}
]
}
},
"validations":[
{
"field":"string",
"regex":"string"
}
]
}'
|