This class helps you to create a REST response to a scripted REST API Request.

setBody(body)


Sets the response content.

Parameter:

NameTypeMandatoryDefault Value
bodyObjectYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

let body = {};
body.name = 'incident';
body.number = '1234';
body.caller = {'id': 'user1'};
response.setBody(body);

setHeader(header, value)


This method allows to assign a value to a REST service response header.

Parameters:

NameTypeMandatoryDefault Value
headerStringYN
valueStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

response.setHeader("Location","<URI>");

setHeaders(headers)


Sets the headers for the web service response.

Parameters:

NameTypeMandatoryDefault Value
headersObjectYN


Example:

let headers = {};
headers['X-Total-Count']=100;
headers.Location='https://<your_instance_url>/<resource_endpoint>';
response.setHeaders(headers);


setStatus(status)


This method sets the status code number for the service response.

Parameters:

NameTypeMandatoryDefault Value
StatusIntegerYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

response.setStatus(200);