Skip to main content

Content Negotiation

The Content Negotiation feature within each endpoints allows the implementer to define the Content-Type of the incoming request payload to ensure the correct formatted data is being sent, as well as to define the Content-Type of the outgoing response payload.

This features can be used completely on its own without having to execute any of the other features if you purely just want to convert a document from one format to another.

Supported Content Types:

  • JSON
  • XML

How does this work?​

When creating a new endpoint you can supply a section called transformation to the root of the endpoint schema.

This object will contain the Content-Type for both the input and output payloads

Content Negotiation in practice​

The example is just to illustrate how to go about defining the payload Content-Type for both incoming and outgoing payloads for a specific endpoint.

The below Content Negotiation settings accepts an incoming payload in XML format and then converts it into JSON for the response payload

Below is a basic example of the state object within the endpoint schema

{
"name": "A Sample Endpoint",
"endpoint": {
"pattern": "/sample-endpoint"
},
"transformation": {
"input": "XML",
"output": "JSON"
}
}