https.requestSuiteTalkRest(options)
Method Description |
Sends an HTTPS request to a SuiteTalk REST endpoint and returns the response. Authentication headers are automatically added. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string | Object |
required, if |
The PUT/POST data. This is ignored if the |
2020.2 |
|
string |
required |
The URL of a SuiteTalk REST endpoint. It may also contain query parameters. The URL may be fully qualified, relative, or relative with the /services/rest/ prefix omitted. |
2020.2 |
|
Object |
optional |
The HTTPS headers. |
2020.2 |
|
string |
optional |
The HTTPS method (DELETE, GET, HEAD, POST, PUT). The default value is GET if |
2020.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
— |
The authorization header is set. |
|
— |
The |
|
— |
If the value of the |
|
Missing a required argument: {param name} |
The |
|
— |
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
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 mySuiteTalkRestHeaders = {
myHeaderType: 'Test',
myHeaderStuff: 'This is my header',
myHeaderId: 7
};
var myRestSuiteTalkRestResponse = https.requestSuiteTalkRest({
body: 'My SuiteTalk Rest body',
headers: mySuiteTalkRestHeaders,
method: GET,
url: 'www.SuiteTalkRestUrl.com'
});
Add additional code