Specifying the Data Format
Specifying the Data Format
You can define your REST service to handle data in different formats, such as JSON, XML, text, or CSV. A REST call can specify the form that it expects data it is sending by specifying a ContentType element in the HTTP request and can request the return data format by specifying an Accept element in the HTTP request.
In the DocServer sample, the GetNamespaces() method checks if the REST call requested JSON data with the following:
If $Get(%request.CgiEnvs("HTTP_ACCEPT"))="application/json"