In this lesson, you will learn when to apply, and how to setup and use Extensions.
Extensions allow two types of essential server-side customization use-cases related to data ingestion in SAP Customer Data Platform. It allows validation and optional data-enrichment of individual event records as part of the beginning of the ingestion process pipeline.

The Extension’s request payload is originated during the ingestion using the Event configuration. An example of such payload can be:
12345678910111213{
"callID": "123abc",
"businessUnitId": "4_abc-d123D_456XYZ",
"applicationId": "HB9yTnq1rdm1J3fT3RgJlw",
"dataEventId": "HKabcD",
"extensionPoint": "preProcess",
"data": {
"firstName": "Joseph",
"lastName": "Asif",
"age": 32
}
}
As you can see, it provides you with some metadata indicating the Business Unit, Application, and the Event that triggered the Extension execution. The data object contains one input Event record from the original Event input payload provided during ingestion.
When your REST-compliant extension code receives this request payload, it must provide a timely response that validates and optionally enriches the event record with additional customer data. As this is custom server-side code, anything is possible in terms of validation, including connecting to your SAP S/4HANA Cloud, SAP BTP, or any other systems in your IT infrastructure. It is up to your developers to code the script that will handle the validation and enrichment. The possible scenarios are:
- Validation of individual event record: It’s up to your REST-compliant server-side code to decide if record ingestion should happen, then return a status to tell SAP Customer Data Platform whether or not to ingest the customer data.
For the records you want to indicate have passed Extension validation, set "OK" as the status attribute. Here is an example of such an Extension response payload:
JSON12345{ "status": "OK", "errorMessage": "" }For the records you want to indicate have failed Extension validation, set the status attribute to "fail". It is also good practice to provide a relevant errorMessage telling the SAP Customer Data Platform why this Event record ingestion should fail, allowing this to be checked further in the Ingestion Monitoring logs. Here is an example of such Extension response payload:
JSON12345{ "status": "fail", "errorMessage": "The customer’s country needs to be part of the EU" } - Optional data enrichment: for situations when you return an "OK" status, you can optionally enrich the original Event individual record with extra attribute values that will be merged into it.
Add a data.extension object to the Extension’s response payload with the additional data you want to add to the original Event record. That will be merged into the event record, and also ingested as long as it is both part of the event model schema and linked to the customer schema using the schema mapping configuration. On top of that, the event model and schema validations are also applied, as usual. Here’s an example:
JSON1234567891011{ "status": "OK", "data": { "extension": { "familyStatus": "married", "age": 35 } }, "errorMessage": "" }The Extension request needs to be authenticated using an OAuth 2.0 compliant JWT bearer token. The issuer attribute (part of the bearer token payload) also needs to be validated.
Note
Even though this is out of scope for this lesson, we include Python sample code showing how to perform such authentication validations. In case you need to code your own server-side REST endpoint in another language or platform, please refer to the manual on how to do that. The ready-to-use executable Python sample code here will then serve as a pseudo-code reference covering the minimal concerns you need to address in your own Extension code.