RESTRequest¶
This is a JavaScript wrapper for RESTRequest
Action Summary¶
Action | Description |
---|---|
DoRemoveParameter | Remove one pre-defined parameter. |
DoRemoveRequestHeader | Remove one pre-defined request header by name. |
GetCredential | The HTTP Basic Authentication Credentials (if any). |
GetHeader | HTTP header |
GetMethod | The HTTP Method being used for the request (GET, POST, etc. |
GetName | The name of the request operation |
GetParameter | Access request parameters. |
GetRequestBodyText | The body of the HTTP request in raw text format |
GetUrl | The URL being used to access the web service |
SetCredential | The HTTP Basic Authentication Credentials (if any). |
SetHeader | HTTP header |
SetMethod | The HTTP Method being used for the request (GET, POST, etc. |
SetParameter | Access request parameters. |
SetRequestBodyText | The body of the HTTP request in raw text format |
SetUrl | The URL being used to access the web service |
Action Detail¶
DoRemoveParameter¶
Remove one pre-defined parameter.
RESTRequest.DoRemoveParameter(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Parameter name |
DoRemoveRequestHeader¶
Remove one pre-defined request header by name.
RESTRequest.DoRemoveRequestHeader(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Header name |
GetCredential¶
The HTTP Basic Authentication Credentials (if any). Sample code:
var credential = {};
credential.UserName = "fredbloggs";
credential.Password = "MyPassword";
SeS("Operation_Name").SetCredential(credential);
Another way is to pass user name and password as first and second parameter respectively, e.g. SeS("Operation_Name").SetCredential("fredbloggs", "MyPassword");
RESTRequest.GetCredential()
GetHeader¶
HTTP header
RESTRequest.GetHeader(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Header Name |
GetMethod¶
The HTTP Method being used for the request (GET, POST, etc.)
RESTRequest.GetMethod()
GetName¶
The name of the request operation
RESTRequest.GetName()
GetParameter¶
Access request parameters. Request Body, Headers and Url is then pre-processed by replacing each {paramName} entry with paramName's value.
RESTRequest.GetParameter(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Name of a parameter. |
GetRequestBodyText¶
The body of the HTTP request in raw text format
RESTRequest.GetRequestBodyText()
GetUrl¶
The URL being used to access the web service
RESTRequest.GetUrl()
SetCredential¶
The HTTP Basic Authentication Credentials (if any). Sample code:
var credential = {};
credential.UserName = "fredbloggs";
credential.Password = "MyPassword";
SeS("Operation_Name").SetCredential(credential);
Another way is to pass user name and password as first and second parameter respectively, e.g. SeS("Operation_Name").SetCredential("fredbloggs", "MyPassword");
RESTRequest.SetCredential(value, value2)
Parameters:
Name | Type | Description |
---|---|---|
value | string | object | User name or full object with credentials. |
value2 | string | Password string. Do not set this parameter if you pass object as the first one. |
SetHeader¶
HTTP header
RESTRequest.SetHeader(name, value)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Header Name |
value | string | Header Value |
SetMethod¶
The HTTP Method being used for the request (GET, POST, etc.)
RESTRequest.SetMethod(method)
Parameters:
Name | Type | Description |
---|---|---|
method | string | New request method (if you ever need it!) |
SetParameter¶
Access request parameters. Request Body, Headers and Url is then pre-processed by replacing each {paramName} entry with paramName's value.
RESTRequest.SetParameter(name, value)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Name of a parameter. |
value | string | Value of a parameter |
SetRequestBodyText¶
The body of the HTTP request in raw text format
RESTRequest.SetRequestBodyText(body)
Parameters:
Name | Type | Description |
---|---|---|
body | string | New version of request data |
SetUrl¶
The URL being used to access the web service
RESTRequest.SetUrl(url)
Parameters:
Name | Type | Description |
---|---|---|
url | string | New Url |