How to Change the API response to XML or JSON Format?
This article provides instructions on how you can change the format of Server API response. The available formats are:
- application/json
- application/xml
- text/json
- text/xml
Prerequisites
- Alteryx Server
- Alteryx Server API
Procedure
In the API service, include "Accept" in the HTTP request header and set it to:
- For JSON, choose either one of the following:
- application/json
- text/json
- For XML, choose either one of the following:
Example in Java code:
...
request.addHeader(“Accept", “application/json”);
...
Example in Postman:
image.pngExample in Alteryx API documentation/Swagger:
image.png
Spoilers
Changing the content type for API version 3 does not work. It will either throw an error or there is no effect. TGAL-6745 has been logged to address this.
Additional Resources