Can the API respond in formats other than JSON?
Yes, it is possible to specify in the header or query parameters. In addition to the default JSON format, CSV and XML can also be specified as the output format. You can also specify the output of a JSON file that is compressed in ZIP format.
caution
Some models do not support formats other than JSON, such as authentication.
Specifying in the header
Specify in the Accept header.
In the case of CSV format.
Accept: text/csv
In the case of XML format.
Accept: text/xml
or
Accept: application/xml
In the case of ZIP format.
Accept: application/zip
Specifying in the query parameters
Specify in _output_format
.
In the case of CSV format.
?_output_format=csv
In the case of XML format.
?_output_format=xml
In the case of ZIP format.
?_output_format=zip
If you want to change the data structure of the CSV output by rewriting the headers, etc., refer to How to Implement Original Function into the Postprocess.
Support
If you have any other questions, please contact us or check out Our Slack Community.