https.requestSuitelet(options)

Method Description

Sends an HTTPS request to a Suitelet and returns the response.

This method can only return an internal Suitelet in trusted contexts for authenticated users. http.requestSuitelet(options) can no longer be used to perform outbound HTTPS requests in an anonymous client-side context, such as for shoppers in a Web site. The options.external parameter is removed as of July in NetSuite 2024.1.

Returns

https.ClientResponse

Supported Script Types

Client and server scripts

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

Governance

10 units

Module

N/https Module

Since

2023.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.deploymentId

string

required

The script ID of the script deployment record.

2023.1

options.scriptId

string

required

The script ID of the script record.

2023.1

options.body

string | Object

optional

The POST data. This parameter is ignored if the value of the options.method parameter is not POST or PUT.

2023.1

options.headers

Object

optional

The HTTPS headers.

2023.1

options.method

string

optional

The HTTPS method (DELETE, GET, HEAD, POST, PUT). The default value is GET if options.body is not specified, and POST if options.body is specified.

2023.1

options.urlParams

Object

optional

Parameters to be appended to the target URL as a query string.

2023.1

Errors

Error Code

Error Message

Thrown If

INVALID_SCRIPT_DEPLOYMENT_ID_1

The options.deploymentId parameter does not reference a valid deployment for the script.

SSS_AUTHORIZATION_HEADER_NOT_ALLOWED

The authorization header is set.

SSS_INVALID_HEADER

The options.headers parameter is in an invalid format or contains an invalid header.

SSS_INVALID_SCRIPT_ID_1

The options.scriptId parameter does not reference a Suitelet script.

SSS_INVALID_URL_PARAMS

The options.urlParams parameter is in an invalid format.

SSS_MISSING_REQD_ARGUMENT

Missing a required argument: {param name}

The options.deploymentId or options.scriptId parameter is not specified.

SSS_REQUEST_LOOP_DETECTED

The script executes a recursive function that has exceeded the limit for the number of times a script can call itself using an HTTPS request.

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/https Module Script Samples.

            // Add additional code
...
https.requestSuitelet({
    scriptId: "custscript_myScript",
    deploymentId: "custdeploy_myDeployment",
    urlParams: {
        address: address
    }
});
...
// Add additional code 

          

Related Topics

General Notices