Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This class allows to perform access scripted REST API request details in scripts. 


body


The body of the request.


Name

TypeMandatoryDefault value 
bodySimpleApiRequest objectYN

Example:

Code Block
languagejs
themeEclipse
titlebody
linenumberstrue
letconst sbodybodyValue = {
    "sys_id": "1234567890",
    "name": "incident"
};



getHeader


Returns the value of the header specified.

NameTypeMandatoryDefault value
getHeaderStringYN

Example:

Code Block
languagejs
themeEclipse
titlegetHeader
linenumberstrue
const acceptHeader = request.getHeader('"accept'");


headers


This method allows defining all request headers and their values.

NameTypeMandatory
headersSimpleRequest objectY

Example:

Code Block
languagejs
themeEclipse
titleheaders
linenumberstrue
letconst sheaderheaderValue = {
   content-type: "Applicationapplication/json"
};


queryParams


The query parameters from the request.


FieldTypeMandatoryDefault value
queryParamsSimpleRequest objectYN


Example:

Code Block
languagejs
themeEclipse
titlequeryParams
linenumberstrue
// Source request URL: https://instance.simpleone.ru/api/now/table/myTable?active=false&name=now
letconst pqueryqueryParams = {
    "active": "false",
    "name": "now"
};


queryString


The entire query added to the endpoint URL


FieldTypeMandatoryDefault value
queryStringSimpleApiRequest objectYN


Example:

Code Block
// Source request URL: https://instance.simpleone.ru/api/now/table/myTable?active=false&name=now
letconst qstringqueryValue = {
   "query": "active=false&name=now"
};


uri


The request URI with the domain information excluded.

FieldTypeMandatoryDefault value
uriStringYN


Example:

Code Block
languagexml
themeEclipse
titleURI
linenumberstrue
const query = request.uri; //"api/now/table/myTable"	
Source request URL: https://instance.simpleone.ru/api/now/table/myTable?active=false&name=now.


url


The entire request URL.


FieldTypeMandatoryDefault value
urlStringYN

Example:

Code Block
languagexml
themeEclipse
titleURL
linenumberstrue
const query = request.url; //"https://instance.simpleone.ru/api/now/table/myTable?active=false&name=now"
Source request URL: https://instance.simpleone.ru/api/now/table/myTable?active=false&name=now.


Table of Contents
absoluteUrltrue
classfixedPosition