Transform API

Provides the transformation between all supported API formats e.g. XML, JSON and compact JSON

Formats Transformation

Transformation between different API formats

Description

We currently support different API formats, e.g. XML, JSON, Compact JSON. This endpoint could transform them from any source format to target format. It helps the users to understand/compare the different formats easily.

It only supports the transformation for OmnType data.

Table 1. Details

Resource path

/api/core/v1/common/transform

HTTP method

POST

Request content type

  • application/xml; charset=UTF-8;

  • application/json

  • application/json+compact

Response content type

  • application/xml; charset=UTF-8;

  • application/json

  • application/json+compact

Body Parameter

Accept one of the supported format (XML, JSON or Compact JSON) which has the data type OmnType.

Use HTTP header Content-Type to specify your source format.

Name Description Required Default Pattern

OmnType

OmnType

X

Return Type

Return the expected format which has the same type OmnType.

Use HTTP header Accept to specify your expect target format.

Responses
Table 2. Http response codes
Code Message Datatype

200

Responses for each message

OmnType

400

Bad request. Indicates an issue with the format of the request (missing required value or a wrong data type)

ResponsesType

Samples
Transform XML format to compact or default JSON
curl
curl --location --request POST 'https://<OMN_SERVER>/api/core/v1/common/transform' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/xml' \
--header 'Accept: application/json+compact' \
--data-raw '<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <meta>
        <itm key="messageType">request</itm>
        <itm key="messageMode">delta</itm>
        <itm key="messageTime">2019-09-17T11:32:08.022Z</itm>
        <itm key="sourceEnv">customer-prod</itm>
        <itm key="productImportPreProcessor">customerProductImportPreProcessor</itm>
        <itm key="productImportPostProcessor">customerProductImportPostProcessor</itm>
        <itm key="projectImportPostProcessor">defaultProjectImportPostProcessor</itm>
    </meta>
</pim>'
Request body PimType in XML format

(Content-Type Header: application/xml)

<pim xmlns="http://www.apollon.de/omn" schemaVersion="5.6.0">
    <meta>
        <itm key="messageType">request</itm>
        <itm key="messageMode">delta</itm>
        <itm key="messageTime">2019-09-17T11:32:08.022Z</itm>
        <itm key="sourceEnv">customer-prod</itm>
        <itm key="productImportPreProcessor">customerProductImportPreProcessor</itm>
        <itm key="productImportPostProcessor">customerProductImportPostProcessor</itm>
        <itm key="projectImportPostProcessor">defaultProjectImportPostProcessor</itm>
    </meta>
</pim>
Response body with compact JSON format (Accept: application/json+compact)
{
    "meta": {
        "messageType": "request",
        "messageMode": "delta",
        "messageTime": "2019-09-17T11:32:08.022Z",
        "sourceEnv": "customer-prod",
        "productImportPreProcessor": "customerProductImportPreProcessor",
        "productImportPostProcessor": "customerProductImportPostProcessor",
        "projectImportPostProcessor": "defaultProjectImportPostProcessor"
    },
    "schemaVersion": "5.6.0"
}
Response body with default JSON format (Accept: application/json)
{
    "meta": {
        "itm": [
            {
                "key": "messageType",
                "value": "request"
            },
            {
                "key": "messageMode",
                "value": "delta"
            },
            {
                "key": "messageTime",
                "value": "2019-09-17T11:32:08.022Z"
            },
            {
                "key": "sourceEnv",
                "value": "customer-prod"
            },
            {
                "key": "productImportPreProcessor",
                "value": "customerProductImportPreProcessor"
            },
            {
                "key": "productImportPostProcessor",
                "value": "customerProductImportPostProcessor"
            },
            {
                "key": "projectImportPostProcessor",
                "value": "defaultProjectImportPostProcessor"
            }
        ]
    },
    "schemaVersion": "5.6.0"
}

Welcome to the AI Chat!

Write a prompt to get started...