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. |
Resource path |
/api/core/v1/common/transform |
HTTP method |
POST |
Request content type |
|
Response content type |
|
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 |
X |
Return Type
Return the expected format which has the same type OmnType.
Use HTTP header Accept to specify your expect target format.
Responses
| Code | Message | Datatype |
|---|---|---|
200 |
Responses for each message |
|
400 |
Bad request. Indicates an issue with the format of the request (missing required value or a wrong data type) |
Samples
Transform XML format to compact or default JSON
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>'
(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>
{
"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"
}
{
"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"
}