HTTP PUT Request Error Handling in SuiteScript

Learn error handling for HTTP PUT requests in SuiteScript, including common codes and governance limits.

·2 min read·View Oracle Docs

TL;DR Opening

This article covers error handling for HTTP PUT requests in SuiteScript, outlining common error codes, timeout behavior, and required parameters. Understanding these elements is crucial for developers to effectively manage HTTP requests and enhance script reliability.

What is an HTTP PUT Request in SuiteScript?

An HTTP PUT request in SuiteScript is used to send data to a specified resource on the web, primarily for updating information. The HTTP request mechanism is supported in both client and server scripts through the N/http module.

Method Description

When sending an HTTP PUT request using SuiteScript, keep in mind:

  • Connection timeouts occur if the connection takes longer than 5 seconds.
  • The request payload must be sent within 45 seconds, or the request will timeout.
  • This method cannot be used in unauthenticated client-side contexts.
  • Consult relevant resources for further details regarding outbound HTTPS in such contexts.

Potential Errors with HTTP PUT Requests

While implementing HTTP PUT requests, developers may encounter various errors. Here are some of the common error codes along with their messages:

Error CodeMessageThrown If
SSS_INVALID_HOST_CERTAn untrusted, unsupported, or invalid certificate was found for this host.The client and server could not negotiate the desired security level, or the domain name in the URL is incorrect. Verify the domain syntax.
SSS_INVALID_URLThe URL must be a fully qualified HTTP/HTTPS URL.An invalid URL is specified in the options.url parameter.
SSS_MISSING_REQD_ARGUMENTMissing a required argument: {param name}.The options.body or options.url parameter is not specified.

Required Parameters

To successfully execute an HTTP PUT request, the following parameters are necessary:

  • options.body: Required. This parameter takes a string or Object data type, representing the PUT data.
  • options.url: Required. This parameter is a string and specifies the HTTP URL being requested.
  • options.headers: Optional. An object that includes the HTTP headers.

Syntax Example

Below is a code sample demonstrating the syntax for a SuiteScript HTTP PUT request:

suitescript
1// Add additional code
2...
3var headerObj = {
4 name: 'Accept-Language',
5 value: 'en-us'
6};
7var response = http.put({
8 url: 'http://www.google.com',
9 body: 'My PUT Data',
10 headers: headerObj
11});
12...
13// Add additional code

Who This Affects

  • Developers: Those implementing RESTful services and HTTP calls within SuiteScript.
  • Administrators: Individuals overseeing script deployment and functionality in NetSuite.

Key Takeaways

  • HTTP PUT requests allow data updates to specified resources.
  • Common errors include untrusted certificates and invalid URLs.
  • Timeout settings require connection within 5 seconds and data payload within 45 seconds.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

What are the common error codes for HTTP PUT requests in SuiteScript?
Common error codes include SSS_INVALID_HOST_CERT for untrusted certificates, SSS_INVALID_URL for malformed URLs, and SSS_MISSING_REQD_ARGUMENT when required arguments are missing.
What timeout settings apply to HTTP PUT requests in SuiteScript?
HTTP PUT requests must establish a connection within 5 seconds, and the request payload must be sent within 45 seconds.
What parameters are required to execute an HTTP PUT request using SuiteScript?
The required parameters include 'options.body' for the PUT data and 'options.url' for the HTTP URL. 'options.headers' is optional.
Can HTTP PUT requests in SuiteScript be used in unauthenticated client-side contexts?
No, HTTP PUT requests cannot be used in unauthenticated client-side contexts in SuiteScript.
Source: Errors Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →