Formats
Character Encoding/ Coding
Regardless of the format, the transfer and return of data is always UTF8
coded. If your application uses a different character encoding (e.g. ISO-8859-1), the posting data must be converted into the appropriate format before transfer.
Validation of the requests
All write requests (e.g. the posting of a registration form) validated using a JSON schema to ensure valid data structure. Corresponding schemas are noted under the respective items of the documentation.
Official documentation and syntax explanation under json-schema.org
!!! info Requests in a different format (e.g.) are also checked via the schemas, but are first converted internally to JSON.
Supported Formats
The interface can be used with different formats. These are explained in the following points and special features are highlighted.
The following formats are supported:
Format | Code | Used | URL Parameters |
---|---|---|---|
JSON | json |
Standard | ?format=json (not necessary, since standard) |
XML | xml |
explicit entry | ?format=xml |
Call JSON endpoint
1 | POST /endpoint url # or explicitly POST /endpoint url?format=json
|
Call XML endpoint
1 | POST /endpunk-url?format=xml |
Warning
The format' parameter must be passed in as a URL parameter for both read (
GET') and write (POST',
PUT') requests if a format other than the default is to be used.
JSON
Only valid JSON syntax according to the specification can be accepted. Spaces and/or line breaks are not relevant here.
1 | {"a":"b","c":"d"} |
is equivalent to:
1 | { "a": "b", "c": "d" } |
Libraries that can be used to create the JSON format can be found in all major programming languages and environments, making implementation easy. A list of common libraries can be found at json.org.
Official specification and examples: json.org
XML
The API can also be accessed via the XML format. All URL endpoints of the API remain, but must be passed with the format
parameter (see below)
!!! info Both the transfer and return of the API are transmitted in XML.
URL Parameters
To use the XML format it is necessary to use the GET parameter format
with the value xml
behind all calling URLs.
To call up an authentication in XML format, the URL is
POST /api/token/?format=xml
Special Features XML format
Root-Element
XML documents will always begin with the element <root>
and end with </root>
Example:
1 | <root><!-- Es folgt das eigentliche Dokument zur Übergabe --></root> |
Listen / Arrays
Array elements are always provided with the tag <list-item>
Example: Transfer of a list of 3 registration forms
1 2 3 4 5 6 | <root> <meldescheine> <list-item><!-- weitere Daten --></list-item> <list-item><!-- weitere Daten --></list-item> <list-item><!-- weitere Daten --></list-item> </meldescheine><!-- weitere Daten --></root> |