Skip to content

Transformation API (1)

This API possibility to transform string with python code.

Languages
Servers
Mock server

https://idp.cdq.com/_mock/apis/transformation-api/api-v1/

Production SOAP

https://api.corporate-data-league.ch/transformation-api/soap/v1/

Production

https://api.corporate-data-league.ch/transformation-api/

Configurations

Data Transformation Configurations

Operations

Transformations

Transformations

Operations

Transform JSON

Request

Transform JSON string using data transformation definition ID.

Security
oAuth2
Path
idstringrequired

ID of the data transformation definition.

Example: c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4
Bodyapplication/jsonrequired
inputJsonArray of objects(JsonObject)

List of JSON objects to transform.

reverseboolean(TransformReverseToggle)

Set to 'true' if you want to apply the reverse mapping

Default false
Example: "true"
validationSchemaIdstring(JsonValidationSchemaId)

ID of Json validation schema

Example: "66432427ba96dd27add2ea34"
curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/datatransformationdefinitions/c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4/transform \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "inputJson": [
      {}
    ],
    "reverse": "true",
    "validationSchemaId": "66432427ba96dd27add2ea34"
  }'

Responses

OK

Bodyapplication/json
resultJsonArray of objects(JsonObject)

List of transformed JSON objects.

Response
application/json
{ "resultJson": [ {} ] }

Transform JSON

Request

Transform JSON string using data transformation definition ID.

Security
oAuth2
Path
idstringrequired

ID of the data transformation definition.

Example: c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4
Bodyapplication/jsonrequired
inputJsonArray of objects(JsonObject)

List of JSON objects to transform.

reverseboolean(TransformReverseToggle)

Set to 'true' if you want to apply the reverse mapping

Default false
Example: "true"
validationSchemaIdstring(JsonValidationSchemaId)

ID of Json validation schema

Example: "66432427ba96dd27add2ea34"
curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/public/datatransformationdefinitions/c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4/transform \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "inputJson": [
      {}
    ],
    "reverse": "true",
    "validationSchemaId": "66432427ba96dd27add2ea34"
  }'

Responses

OK

Bodyapplication/json
resultJsonArray of objects(JsonObject)

List of transformed JSON objects.

Response
application/json
{ "resultJson": [ {} ] }

Transform JSON with Data Transformation Definition

Request

Transform JSON string using provided data transformation definition.

Security
oAuth2
Bodyapplication/json
inputJsonArray of objects(JsonObject)

List of JSON objects to transform.

reverseboolean(TransformReverseToggle)

Set to 'true' if you want to apply the reverse mapping

Default false
Example: "true"
validationSchemaIdstring(JsonValidationSchemaId)

ID of Json validation schema

Example: "66432427ba96dd27add2ea34"
dataTransformationDefinitionobject(DataTransformationDefinitionInternalCreate)

Create data transformation definition.

curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/datatransformationdefinitions/transform \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "inputJson": [
      {}
    ],
    "reverse": "true",
    "validationSchemaId": "66432427ba96dd27add2ea34",
    "dataTransformationDefinition": {
      "imports": [
        {
          "id": "c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4"
        }
      ],
      "name": "My DTD",
      "direction": "INBOUND",
      "type": {
        "name": "BUSINESS_PARTNER",
        "technicalKey": "BUSINESS_PARTNER"
      },
      "mappings": [
        {
          "sourceAttributes": [
            "businessPartner.record"
          ],
          "sourceSelections": [
            {
              "selectionType": "CONCATENATION",
              "value": ","
            }
          ],
          "targetAttributes": [
            "businessPartner.externalId"
          ],
          "targetTransformations": [
            {
              "constantValue": "constant",
              "targetAttributes": [
                "businessPartner.externalId"
              ],
              "transformationName": "CAPITALIZE",
              "defaultValue": "default",
              "transformationType": "CAPITALIZE"
            }
          ],
          "ignoredValues": [
            "ignored value"
          ]
        }
      ],
      "reverseMappings": [
        {
          "sourceAttributes": [
            "businessPartner.record"
          ],
          "sourceSelections": [
            {
              "selectionType": "CONCATENATION",
              "value": ","
            }
          ],
          "targetAttributes": [
            "businessPartner.externalId"
          ],
          "targetTransformations": [
            {
              "constantValue": "constant",
              "targetAttributes": [
                "businessPartner.externalId"
              ],
              "transformationName": "CAPITALIZE",
              "defaultValue": "default",
              "transformationType": "CAPITALIZE"
            }
          ],
          "ignoredValues": [
            "ignored value"
          ]
        }
      ],
      "valueMappings": [
        {
          "sourceConditions": [
            {
              "sourceValue": "AU",
              "sourceAttribute": "$.identifications[*].country.code",
              "sourceRegex": "^GR\\..{1,}"
            }
          ],
          "sourceValue": "AE1",
          "targetValue": "AE",
          "targetAttribute": "$.identifications[*].country.code",
          "sourceAttribute": "$.identifications[*].country.code",
          "disabled": "false"
        }
      ],
      "values": [
        {
          "sourceValue": "AE1",
          "sourceAttribute": "identifications[*].indentificationType.code"
        }
      ],
      "customTransformations": [
        {
          "name": "Code above.",
          "code": "Code above."
        }
      ]
    }
  }'

Responses

OK

Bodyapplication/json
resultJsonArray of objects(JsonObject)

List of transformed JSON objects.

Response
application/json
{ "resultJson": [ {} ] }

Transform JSON with Data Transformation Definition

Request

Transform JSON string using provided data transformation definition.

Security
oAuth2
Bodyapplication/json
inputJsonArray of objects(JsonObject)

List of JSON objects to transform.

reverseboolean(TransformReverseToggle)

Set to 'true' if you want to apply the reverse mapping

Default false
Example: "true"
validationSchemaIdstring(JsonValidationSchemaId)

ID of Json validation schema

Example: "66432427ba96dd27add2ea34"
dataTransformationDefinitionobject(DataTransformationDefinitionCreate)

Create data transformation definition.

curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/public/datatransformationdefinitions/transform \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "inputJson": [
      {}
    ],
    "reverse": "true",
    "validationSchemaId": "66432427ba96dd27add2ea34",
    "dataTransformationDefinition": {
      "imports": [
        {
          "id": "c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4"
        }
      ],
      "name": "My DTD",
      "direction": "INBOUND",
      "type": {
        "name": "BUSINESS_PARTNER",
        "technicalKey": "BUSINESS_PARTNER"
      },
      "mappings": [
        {
          "sourceAttributes": [
            "businessPartner.record"
          ],
          "sourceSelections": [
            {
              "selectionType": "CONCATENATION",
              "value": ","
            }
          ],
          "targetAttributes": [
            "businessPartner.externalId"
          ],
          "targetTransformations": [
            {
              "constantValue": "constant",
              "targetAttributes": [
                "businessPartner.externalId"
              ],
              "transformationName": "CAPITALIZE",
              "defaultValue": "default",
              "transformationType": "CAPITALIZE"
            }
          ],
          "ignoredValues": [
            "ignored value"
          ]
        }
      ],
      "reverseMappings": [
        {
          "sourceAttributes": [
            "businessPartner.record"
          ],
          "sourceSelections": [
            {
              "selectionType": "CONCATENATION",
              "value": ","
            }
          ],
          "targetAttributes": [
            "businessPartner.externalId"
          ],
          "targetTransformations": [
            {
              "constantValue": "constant",
              "targetAttributes": [
                "businessPartner.externalId"
              ],
              "transformationName": "CAPITALIZE",
              "defaultValue": "default",
              "transformationType": "CAPITALIZE"
            }
          ],
          "ignoredValues": [
            "ignored value"
          ]
        }
      ],
      "valueMappings": [
        {
          "sourceConditions": [
            {
              "sourceValue": "AU",
              "sourceAttribute": "$.identifications[*].country.code",
              "sourceRegex": "^GR\\..{1,}"
            }
          ],
          "sourceValue": "AE1",
          "targetValue": "AE",
          "targetAttribute": "$.identifications[*].country.code",
          "sourceAttribute": "$.identifications[*].country.code",
          "disabled": "false"
        }
      ],
      "values": [
        {
          "sourceValue": "AE1",
          "sourceAttribute": "identifications[*].indentificationType.code"
        }
      ]
    }
  }'

Responses

OK

Bodyapplication/json
resultJsonArray of objects(JsonObject)

List of transformed JSON objects.

Response
application/json
{ "resultJson": [ {} ] }

Transform Message

Request

Request or response message are transformed according to the configuration of the transformation extensions in the respective OpenAPI specification.

Security
oAuth2
Bodyapplication/json
configurationIdstring(MessageTransformationConfigurationId)required

ID of the message transformation which should be applied.

Example: "/sap-odm/v2"
urlstring(MessageTransformationUrl)required

URL of the original message to be transformed.

Example: "referencedata/rest/businesspartners/lookup"
messageobject(JsonObject)required

JSON object

message.​property name*anyadditional property
typestring(MessageType)required
  • REQUEST: Request or inbound message * RESPONSE: Response or outbound message
Example: "REQUEST"
curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/datatransformationdefinitions/transformMessage \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "configurationId": "/sap-odm/v2",
    "url": "referencedata/rest/businesspartners/lookup",
    "message": {},
    "type": "REQUEST"
  }'

Responses

OK

Bodyapplication/json
transformedMessageobject(JsonObject)

JSON object

Response
application/json
{ "transformedMessage": {} }

Proxy Message

Request

This endpoint is just a workaround for limitations of the Kong Python Plugin. Transformations API will call the target API and transform inbound and outbound payloads. Later, this functionality shall go back to the API Gateway layer.

Security
oAuth2
Headers
X-Forwarded-Methodstringrequired

Http method GET or POST for original request.

Example: GET
Cdq-Forwarded-Pathstringrequired

Path of the original request

Example: /api/v1/lookup
X-Message-Transformation-Configuration-Idstringrequired

ID of the transformation configuration.

Example: c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4
Bodyapplication/json
property name*anyadditional property
curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/datatransformationdefinitions/proxyMessage \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Cdq-Forwarded-Path: /api/v1/lookup' \
  -H 'Content-Type: application/json' \
  -H 'X-Forwarded-Method: GET' \
  -H 'X-Message-Transformation-Configuration-Id: c074b9f3-abf0-4f8e-9a20-74deb6cfa2a4'

Responses

OK

Bodyapplication/json
property name*anyadditional property
Response
application/json
"example"

Transform String

Request

Transform string with custom logic defined as python code.

Security
oAuth2
Bodyapplication/json
transformationScriptstring

Python code to transform the input string.

Example: "code"
contentToTransformstring

Content to transform.

Example: "content"
curl -i -X POST \
  https://idp.cdq.com/_mock/apis/transformation-api/api-v1/transformation \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "transformationScript": "code",
    "contentToTransform": "content"
  }'

Responses

OK

Bodyapplication/json
inputJsonstring

Input JSON string.

Example: "{...}"
transformationResultsArray of objects(TransformationResultItem)

The transformation script can return one string or map of key values. Depending on the return type in the script, the transformationResults will have different structure:

  • when a script returns a string, the result array will have one element without key
  • when a script returns a map, then the array will have filled the key and values
Response
application/json
{ "inputJson": "{...}", "transformationResults": [ {} ] }

Data Transformation Definitions

Data Transformation Definitions

Operations

Data Transformation Schemas

Data Transformation Schemas

Operations