RESTAPIResponse - getStreamWriter()

Get the ResponseStreamWriter for this response, allowing you to write directly to the response stream.

Set the content type and status code using the setHeaders and setStatus functions prior to calling the getStreamWriter function. If you do not set a status code, the status code defaults to 200.
Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
RESTAPIResponseStream - Scoped, Global The ResponseStreamWriter for this response. You can use this object to write directly to the response stream.
response.setContentType('application/json');
response.setStatus(200);
var writer = response.getStreamWriter();