# Tutorial: How to get results in your data model with Transformation API ## Overview **Use Case** This use case describes how to get results from CDQ services in your data model by using the Transformation API. **Learning Goals** In this tutorial, the user will focus on: - Creating Data Transformation Definitions - Creating Data Transformation Configuration - Attaching Data Transformation Configuration to the API KEY - Using the Transformation API to transform results into your data model ## Step 1: Create Data Transformation Definition Data Transformation Definition needs to be created in the same workspace where the Data Monitor was created. Elements of the DTD you can provide: | Element | Description | | --- | --- | | `name` | Name of your DTD | | `type` | `BUSINESS_PARTNER`, `UPDATED_BUSINESS_PARTNER`, `BANK_ACCOUNT`. | | `direction` | Direction of the Data Transformation Definition - `INBOUND` (from customer to CDQ model)(default) or `OUTBOUND` (from CDQ to customer model). | | `imports` | Takes mappings from another, already created DTD, without the need to include these elements in the mapping. | | `mappings` | Declares what and how should be mapped from the input to the output structure. | | `reverseMappings` | Declares what and how should be mapped from the output to the input structure. | | `valueMappings` | Change values from input to output based on a defined rule. | | `values` | Defines allowed values for provided attributes. | To create a Data Transformation Definition: 1. Use the **Data Transformation Definition** endpoint, Attention The **Create Data Transformation Definition** example is set by default. 1. Provide the required fields in the body. Remember Adjust your DTD to your needs. Most common issues were explained in the instruction: [How to Define and Use Data Transformation Definitions (DTD) in CDQ Cloud Apps](/documentation/instructions/define-data-transformation-definitions) ## Step 2: Create Data Transformation Configuration To use the created Data Transformation Definition, you need to create a Data Transformation Configuration in the same workspace where the Data Monitor was created. To create a Data Transformation Configuration: 1. Go to the [Data Transformation Configurator](https://apps.cdq.com/dashboard/data-transformation-configurator) app. 2. Click the **Create New Configuration** button. 3. Fill in the **Configuration name** and click **Create** button. 4. Search the newly created configuration and click the **See Details** button. 5. In the details of the configuration, set the required parameters: * Set the required value in the Business Partner field. * Set the required value in the Updated Business Partner field. | | | --- | | ![](/assets/dtd-config-img1.d382f45e796800641042b850d62959514a2547b8fda3312ca80d06c9a07cdac1.59b0b139.png) | ## Step 3: Attach configuration to API Key To use the created Data Transformation Configuration, you need to attach it to the API Key in the same workspace where the Data Monitor was created. To attach the configurations to your API Key: 1. Go to the [API Key Management](https://apps.cdq.com/dashboard/api-key-management) app. 2. Click the **See Details** button of the earlier created API Key. 3. Find the Data Transformation Configuration section and assign the created configuration. 4. Click the **Save changes** button. | | | --- | | ![](/assets/dtd-config-img2.e6fd5dbce2f89c3a0bfacd417a87eb15975160894733cd7e21a5415d98e37a73.59b0b139.png) | ## Step 4: Transform into data model You are ready to get results by using the Transformation API. ### Endpoints supporting transformations CDQ applies special logic to endpoints and APIs based on the attached API key. The Data Transformation Configuration returns a response or allows you to provide the input elements in the customer data model. Dedicated endpoints supporting transformation: - [Fetch Business Partner](/apis/referencedata-api/api-v3/business-partners/paths/~1v3~1businesspartners~1fetch/post) - [Curate Business Partner](/apis/data-curation-api/api-v3/business-partners/paths/~1v3~1businesspartners~1curate/post) - [Read Augmented Business Partner](/apis/data-clinic-api/api-v2/augmented-business-partners/paths/~1v2~1storages~1%7Bstorageid%7D~1datasources~1%7Bdatasourceid%7D~1augmentedbusinesspartners~1fetch/post) - [List Business Partner Updates](/apis/data-exchange-api/api-v5/business-partners/paths/~1v5~1storages~1%7Bstorageid%7D~1businesspartners~1updates/get) - [Confirm Business Partner](/apis/data-clinic-api/api-v2/business-partners/paths/~1v2~1businesspartners~1confirm/post) Dedicated APIs supporting transformation: - [SAP.ODM API](/documentation/api/sap-odm/quickstart) - [SAP.DQM API](/documentation/api/sap-dqm/quickstart) - [SAP.BN API](/documentation/api/sap-bn/quickstart) Remember To transform the response from CDQ services into the required model, use the API Key with the attached Data Transformation Configuration. ### Transform JSON Any JSON file can be transformed with the Transform JSON endpoint. To transform JSON with an existing DTD: 1. Use the **[Transform JSON](/apis/transformation-api/api-v1/transformations/paths/~1datatransformationdefinitions~1%7Bid%7D~1transform/post)** endpoint, 2. Fill the empty JSON input. ### Transform JSON with DTD You can transform any JSON with the provided DTD and quick adjustments. To transform JSON with DTD: 1. Use the **[Transform JSON with Data Transformation Definition](/apis/transformation-api/api-v1/transformations/paths/~1datatransformationdefinitions~1transform/post)** endpoint, 2. Provide the required fields in the body. ## Your opinion matters! We are constantly working on providing an outstanding user experience with our products. Please share your opinion about this tutorial!