You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This server class

Change the REST_message_record text from the examples below to the record name of your REST message.

execute()

Sends the REST message.


Return:

TypeDescription
SimpleRestResponseResponse to the message sent by the execute() method.


Example:

execute
var sm = new sn_ws.SimpleRestRequestApi(“REST_message_record”, “get”);
var response = sm.execute();

setBasicAuth(userName, userPass)

Sets the username for web-service auth if the basic auth type was chosen. 


Parameter(s):

NameTypeMandatoryDefault Value
userNameStringYN
userPassStringYN


Return:

TypeDescription



Example:

setBasicAuth
var sm = new sn_ws.SimpleRestRequestApi(“REST_message_record”, “get”);
sm.setBasicAuth(“username”, “password”);

setRequestUrl(requestUrl)

Sets the request URL.


Parameter(s):

NameTypeMandatoryDefault Value
requestUrlStringYN


Return:

TypeDescription



Example:

setRequestUrl
var sm = new sn_ws.SimpleRestRequestApi(“REST_message_record”, “get”);
sm.setRequestUrl(“url”);

setRequestMethod(methodName)

Sets the requesting method (GET, POST, PURGE, etc). Accepts the requesting method name.


Parameter(s):

NameTypeMandatoryDefault Value
methodNameStringYN


Return:

TypeDescription



Example:

setRequestMethod
var sm = new sn_ws . SimpleRestRequestApi(“REST_message_record”, “get”);
sm.setRequestMethod(“get”);

setRequestTimeout(timeout)

Sets the response timeout until the request is out of time.


Parameter(s):

NameTypeMandatoryDefault Value
timeoutIntegerYN


Return:

TypeDescription



Example:

setRequestTimeout
var sm = new sn_ws . SimpleRestRequestApi(“REST_message_record”, “get”);
sm.setRequestTimeout(“60000”);

setQueryParameter(name, value)

Adds a parameter into the end of the URL request formed as a "name=value",


Parameter(s):

NameTypeMandatoryDefault Value
nameStringYN
valueStringYN


Return:

TypeDescription



Example:

setQueryParameter
var sm = new sn_ws . SimpleRestRequestApi(“REST_message_record”, “get”);
sm.setQueryParameter(“sysparm_query”, “active=true^ORDERBYDESCcategory”);

setRequestBody(body)

Sets the request body when used PUT or POST methods.


Parameter(s):

NameTypeMandatoryDefault Value
bodyStringYN


Return:

TypeDescription



Example:

setRequestBody
var sm = new sn_ws . SimpleRestRequestApi(“REST_message_record”, “get”);
var body = “<Message body content>”;
sm.setRequestBody(body);

setRequestHeader(name, value)

Method description


Parameter(s):

NameTypeMandatoryDefault Value
nameString

valueString


Return:

TypeDescription



Example:


Method description


Parameter(s):

NameTypeMandatoryDefault Value





Return:

TypeDescription



Example:


Method description


Parameter(s):

NameTypeMandatoryDefault Value





Return:

TypeDescription



Example:


Method description


Parameter(s):

NameTypeMandatoryDefault Value





Return:

TypeDescription



Example:


  • No labels