https.requestSuitelet.promise(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

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

Use this method to asynchronously perform an outbound HTTPS request in an anonymous client-side context. You can do this by performing the HTTPS request inside a Suitelet that is available without login, then calling the Suitelet inside your client script using the https.requestSuitelet.promise(options) method.

Currently, this method is supported only with the options.external parameter set to true.

Note:

The parameters and errors thrown for this method are the same as those for https.requestSuitelet(options). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

https.requestSuitelet(options)

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.external

boolean

optional

Specifies whether to perform the request as an unauthenticated user; this case uses the Online Form User role.

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 promise script example, see Promise Object.

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

          

Related Support Article

Outbound HTTPs in an unauthenticated client-side context

Related Topics

N/https Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices