http.request(options)
Method Description |
Sends an HTTP request.\
Important:
If it takes longer than 5 seconds to connect to the destination server, the connection times out. If sending the request payload takes more than 45 seconds, the request times out. This method doesn’t work in unauthenticated client-side contexts. For details, see the SuiteAnswers article Outbound HTTPs in an unauthenticated client-side context. |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
enum |
required |
The HTTP request method. Set using http.Method.
Note:
If the method is |
2015.2 |
|
string |
required |
The HTTP URL being requested |
2015.2 |
|
string | Object |
optional |
The POST data if the method is |
— |
|
Object |
optional |
The HTTP headers. For more information, see HTTP Header Information. |
2015.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
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
|
|
The URL must be a fully qualified HTTP/HTTPS URL. |
An invalid URL is specified in the |
|
Missing a required argument: {param name} |
The |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/http Module Script Samples.
// Add additional code
...
var headerObj = {
name: 'Accept-Language',
value: 'en-us'
};
var response = http.request({
method: http.Method.GET,
url: 'http://www.google.com',
body: 'My REQUEST Data',
headers: headerObj
});
...
// Add additional code