Versions Compared

Key

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

This class allows to perform access scripted Methods of this class allow getting access to the Scripted REST API request details in within your scripts. 

body

The body of the request.

Note

Objects of this type cannot be instantiated and created automatically. They are accessible within the API action script body by the request variable. 

For more information, please refer to the Configuring Scripted REST API article.

getBody()


This method allows returning the request body.

Name

TypeMandatoryDefault value bodySimpleApiRequest objectYN

Example:

Code Block
languagejs
themeEclipse
titlebodygetBody
linenumberstrue
const bodyValue = {
(function(request, response) {
    // Send JSON-formatted request to
     "sys_id": "156950788916212912",
    "name": "LDAP Property"
};
getHeader
// https://your-instance-url.simpleone.ru/v1/c_simple/api_module_path/api_action_path

    const requestBody = request.getBody(); // {"key":"value"}
})(SimpleApiRequest, SimpleApiResponse)

getHeader(header)


Returns the value of the header specified.

NameTypeMandatoryDefault value
getHeaderheaderStringYN

 For more clarity, check the example below

Example:

Code Block
languagejs
themeEclipse
titlegetHeader
linenumberstrue
const acceptHeader(function(request, response) {
    // Send JSON-formatted request to
    // https://your-instance-url.simpleone.ru/v1/c_simple/api_module_path/api_action_path

    const contentType = request.getHeader("accept");
headers
'content-type'); // application/json
})(SimpleApiRequest, SimpleApiResponse)


getHeaders()


This method allows defining all request headers and their values.

NameTypeMandatoryheadersSimpleRequest objectY

Example:

Code Block
languagejs
themeEclipse
titleheadersgetHeaders
linenumberstrue
const headerValue = {
   content-type: "application/json"
};

queryParams

(function(request, response) {
    // Send Request to 
    // https://your-instance-url.simpleone.ru/v1/c_simple/api_module_path/api_action_path

    const allHeaders = request.getHeaders() // {"accept-encoding":["gzip, deflate, br"],"postman-token":...}
})(SimpleApiRequest, SimpleApiResponse)


getQueryParams()


This method returns the The query parameters from the request.

FieldTypeMandatoryDefault value

queryParamsSimpleRequest objectYN

Example:

Code Block
languagejs
themeEclipse
titlequeryParamsgetQueryParams
linenumberstrue
(function(request, response) {
    // Source request URL: Send Request to 
    // https://your-instance-url.simpleone.ru/apiv1/now/table/myTable?active=false&name=now
const queryParams = {c_simple/api_module_path/api_action_path?param_1=value_1

    "active": false,
    "name": "now"
};

queryString

const queryParamsObject = request.getQueryParams(); // {"param_1":"value_1"}
})(SimpleApiRequest, SimpleApiResponse)


getQueryString()


This method returns the The entire query added to the endpoint URL.

Field

Example:

Type
Code Block
Mandatory
language
Default value
js
queryString
theme
SimpleApiRequest object
Eclipse
Y
title
N
getQueryParams
(function(request, response) {
    // Send Request to 
    //

Example:

Code Block
// Source request URL: https://your-instance-url.simpleone.ru/apiv1/now/table/myTable?active=false&name=now
const queryValue = {
   "query": "active=false&name=now"
};

uri

c_simple/api_module_path/api_action_path?param_1=value_1

    const queryParamsString = request.getQueryString(); // param_1=value_1
})(SimpleApiRequest, SimpleApiResponse)


getUri()


This method returns the The request URI with the domain information excluded.

FieldTypeMandatoryDefault valueuri

StringYN

Example:

Code Block
languagexmljs
themeEclipse
titleURIgetUri
linenumberstrue
(function(request, response) {
    // Source request URL: Send Request to 
    // https://your-instance-url.simpleone.ru/apiv1/now/table/myTable?active=false&name=now
const queryc_simple/api_module_path/api_action_path?param_1=value_1

    const URI = request.uri;getUri(); // /v1/"api/now/table/myTable"	

url

c_simple/api_module_path/api_action_path
})(SimpleApiRequest, SimpleApiResponse) 


getUrl()


This method returns the The entire request URL.

FieldTypeMandatoryDefault valueurlStringYN

Example:

Code Block
languagexmljs
themeEclipse
titleURLgetUrl
linenumberstrue
(function(request, response) {
    // Source request URL: Send Request to 
    // https://your-instance-url.simpleone.ru/v1/api/now/table/myTable?active=false&name=now
const queryc_simple/api_module_path/api_action_path?param_1=value_1

    const URL = request.urlgetUrl(); //"https http://your-instance-url.simpleone.ru/apiv1/now/table/myTable?active=false&name=now"c_simple/api_module_path/api_action_path
})(SimpleApiRequest, SimpleApiResponse)


Table of Contents
absoluteUrltrue
classfixedPosition