https.put(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Sends an HTTPS PUT request.

Important:

If negotiating a connection to the destination server exceeds 5 seconds, a connection timeout occurs. If transferring a payload to the server exceeds 45 seconds, a request timeout occurs.

Returns

https.ClientResponse or https.ServerResponse

Supported Script Types

Client and server scripts

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

Governance

10 units

Module

N/https Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.body

string | Object

required

The PUT data.

2015.2

options.url

string

https.SecureString

required

The HTTPS URL being ‘put’ to.

Note:

NetSuite does not automatically escape special characters reserved for use in URLs. If your URL includes reserved special characters, you will need to escape them.

You can use an https.SecureString to specify the options.url parameter and you can use the SecureString.replaceString(options) to escape special characters.

For more information about special characters in URLs see https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding or https://developers.google.com/maps/url-encoding.

For information about resolving a URL, see N/url Module. For information about getting the URL for a script, including Suitelets, see url.resolveScript(options).

2015.2

options.credentials

string[]

optional

An array of string GUIDs. These GUIDS are searched for in the options.body of the request and are replaced by the decrypted passwords before they are sent to a third-party server.

2015.2

options.headers

Object

optional

The HTTPS headers.

For more information, see HTTPS Header Information.

2015.2

Errors

Error Code

Message

Thrown If

SSS_INVALID_HOST_CERT

An untrusted, unsupported, or invalid certificate was found for this host.

The client and server could not negotiate the desired level of security. The connection is no longer usable.

You may also receive this error if the domain name in the options.url parameter is spelled incorrectly or does not use valid syntax. Verify that the domain name:

  • Has 63 or fewer characters

  • Contains alphanumeric characters (a-z, A-Z, 0-9) or hyphens

  • Starts with a letter

  • Ends with a letter or digit

SSS_INVALID_URL

The URL must be a fully qualified HTTP/HTTPS URL.

An invalid URL is specified in the options.url parameter.

SSS_MISSING_REQD_ARGUMENT

Missing a required argument: {param name}

The options.body or options.url parameter is not specified.

SSS_REQUEST_LOOP_DETECTED

This script executes a recursive function that has exceeded the limit for the number of times a script can call itself using an HTTP request. Please examine the script for a potential infinite recursion problem.

A script is calling back into itself recursively using an HTTP/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 
...
var headerObj = {
    name: 'Accept-Language',
    value: 'en-us'
};
var response = https.put({
    url: 'https://www.testwebsite.com',
    body: 'My PUT Data',
    headers: headerObj
});
...
// Add additional code 

        

Related Topics

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

General Notices