RESTAPIResponseStream - Scoped, Global
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- API reference
The RESTAPIResponseStream API provides methods that allow you to write directly to the scripted REST API response stream.
Use RESTAPIResponseStream methods to build web service APIs in the Scripted REST API feature.
This API runs in the sn_ws
namespace.
RESTAPIResponseStream - writeStream(Object stream)
Write an input stream to the response stream.
You must set the content type and status code before calling the writeStream() method or the response will fail. You cannot modify these values after calling the writeStream() method.
It is the responsibility of the script author to obtain the stream from a third-party service.
Name | Type | Description |
---|---|---|
stream | Object | An attachment or a response stream from a third-party service. |
Type | Description |
---|---|
void |
Example
The following example is for scoped applications:
Example
The following example is for global applications:
RESTAPIResponseStream - writeString(String data)
Write string data to the response stream.
You must set the content type and status code before calling the writeString() method or the response will fail. You cannot modify these values after calling the writeString() method.
Name | Type | Description |
---|---|---|
data | String | The string to add to the response data. |
Type | Description |
---|---|
void |