⚠️ The annual cost of maintaining the server where this website is hosted, the domain, and keeping it up-to-date is approximately €3,000 per year. Help us with a small donation to cover these expenses. Support Now!

0 / 10000
dw.system
Class RESTSuccessResponse
Object
dw.system.RESTSuccessResponse
This class represents a REST success response that is compliant with the RFC standards. It can only be instantiated using the createSuccess methods in RESTResponseMgr.

Here is an example:
var body = {"hello": "world"}
var success = RESTResponseMgr.createSuccess(body);
success.render();

The above script would result in an HTTP response with status code 200 and the following body:
{
 "hello": "world"
}

Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
render() : void
Sends the RESTSuccessResponse object as an HTTP response to the client.
Method Detail
render
render() : void
Sends the RESTSuccessResponse object as an HTTP response to the client. This sets the "Content-Type" header to "application/json" and expects the body to be a valid JavaScript JSON object.
Throws:
IllegalStateException - If the RESTSuccessResponse object is already rendered.
Exception - If there is an error while serializing the body.