Skip to main content

JSON or XML

The gateway accepts and answers both. It answers in JSON by default, and in XML to callers that speak XML, deciding in this order:
  1. ?format=json or ?format=xml on the request.
  2. An Accept header naming only one of them.
  3. The format of the request body.
  4. JSON.
JSON uses camelCase member names and leaves empty ones out:
The same in XML:
Send JSON with Content-Type: application/json, XML with application/xml.

Results

Errors use the same shape, so the register can show why:
A customer cancelling on the terminal answers Operation cancelled by customer. Every response names the gateway version that handled it in the X-Mojo-Gateway-Version header.