restlet.createResponse(options)

Method Description

Creates a custom RESTlet HTTP response.

Returns

restlet.Response

Supported Script Types

RESTlet scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/scriptTypes/restlet Module

Sibling Module Members

N/scriptTypes/restlet Module Members

Since

2024.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.content

string

required

The content of the response.

options.contentType

string

required

The Content-Type header of the response.

This value overrides the default Content-Type header, which is the same as the Content-Type header of the RESTlet HTTP request.

Errors

Error Code

Error Message

Thrown If

SSS_MISSING_REQD_ARGUMENT

{method name}: Missing a required argument: {param name}

A required parameter is missing.

SSS_INVALID_TYPE_ARG

You have entered an invalid type argument: {param name}

A parameter has an invalid type.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/scriptTypes/restlet Module Script Sample.

            // Add additional code
...
    return restlet.createResponse({ 
        content: 'Hello World',
        contentType: 'text/html'
    });
}
...
// Add additional code 

          

Related Topics

General Notices