This page is maintained for older versions of Rapise only. The latest documentation can be found at: https://rapisedoc.inflectra.com
RESTService

RESTService

Top 

 

This behavior pattern implements REST service client. Extends SeSSimulatedObject.

 

Behavior Pattern: RESTServiceBehavior

 

Property Summary

 

Property

Description

Getter

Setter

Credential

The HTTP Basic Authentication Credentials (if any).

GetCredential

SetCredential

Method

The HTTP Method being used for the request (GET, POST, etc.

GetMethod

SetMethod

Name

The name of the request operation

GetName


Parameters

The list of parameters available for this request url.

GetParameters


RequestBodyObject

The body of the HTTP request deserialized to/from JSON into a JavaScript object.

GetRequestBodyObject

SetRequestBodyObject

RequestBodyText

The body of the HTTP request in raw text format

GetRequestBodyText

SetRequestBodyText

RequestHeaders

The list of HTTP headers that are part of this request.

GetRequestHeaders

SetRequestHeaders

ResponseBodyObject

The body of the HTTP response deserialized from JSON into a JavaScript object.

GetResponseBodyObject


ResponseBodyText

The body of the HTTP response in raw text format

GetResponseBodyText


ResponseHeaders

Returns the list of HTTP headers returned from the HTTP response.

GetResponseHeaders


ResponseIsErrorStatus

Returns 'true 'if an HTTP error code came back from the web service

GetResponseIsErrorStatus


Url

The URL being used to access the web service

GetUrl

SetUrl

 

Action Summary

 

Action

Description

DoExecute

Executes the web service operation, substituting any of the provided parameter values if necessary.

 

Property Detail

 

Credential

The HTTP Basic Authentication Credentials (if any).
Sample code:

var credential = {};

credential.UserName = "fredbloggs";

credential.Password = "MyPassword";

SeS("Operation_Name").SetCredential(credential);

 

Accessors: GetCredential, SetCredential

 

Method

The HTTP Method being used for the request (GET, POST, etc.)

Accessors: GetMethod, SetMethod

 

Name

The name of the request operation

Accessors: GetName

 

Parameters

The list of parameters available for this request url.
Sample code:

var parameters = SeS("Operation_Name").GetParameters();

for (var i = 0; i < parameters.length; i++)

{

 var name = parameters[i].Name;

 var token = parameters[i].TokenName;

 var value = parameters[i].Value;

}

 

Accessors: GetParameters

 

RequestBodyObject

The body of the HTTP request deserialized to/from JSON into a JavaScript object.
Sample code:

var book = {};

book.Name = "A Christmas Carol";

book.AuthorId = 2;

book.GenreId = 3;

SeS("LibraryInformationSystem_Insert_Book").SetRequestBodyObject(book);

SeS("LibraryInformationSystem_Insert_Book").DoExecute({"session_id":sessionId});

 

Accessors: GetRequestBodyObject, SetRequestBodyObject

 

RequestBodyText

The body of the HTTP request in raw text format

Accessors: GetRequestBodyText, SetRequestBodyText

 

RequestHeaders

The list of HTTP headers that are part of this request.
Sample code:

var headers = SeS("Operation_Name").GetRequestHeaders();

for (var i = 0; i < headers.length; i++)

{

 var name = headers[i].Name;

 var value = headers[i].Value;

}

 

Accessors: GetRequestHeaders, SetRequestHeaders

 

ResponseBodyObject

The body of the HTTP response deserialized from JSON into a JavaScript object.
Sample code:

SeS("LibraryInformationSystem_Get_BookById").DoExecute({"session_id":sessionId, "book_id":bookId});

var book = SeS("LibraryInformationSystem_Get_BookById").GetResponseBodyObject();

 

Accessors: GetResponseBodyObject

 

ResponseBodyText

The body of the HTTP response in raw text format

Accessors: GetResponseBodyText

 

ResponseHeaders

Returns the list of HTTP headers returned from the HTTP response.
Sample code:

var headers = SeS("Operation_Name").GetResponseHeaders();

for (var i = 0; i < headers.length; i++)

{

 var name = headers[i].Name;

 var value = headers[i].Value;

}

 

Accessors: GetResponseHeaders

 

ResponseIsErrorStatus

Returns 'true 'if an HTTP error code came back from the web service

Accessors: GetResponseIsErrorStatus

 

Url

The URL being used to access the web service

Accessors: GetUrl, SetUrl

 

Action Detail

 

DoExecute(params)

Executes the web service operation, substituting any of the provided parameter values if necessary.

 

Parameters:

 

Name

Type

Description

params

object

JavaScript object {"name1": "value1", "name2": "value2" }. Parameter values that should be passed to the web service operation.
Sample code:

SeS("LibraryInformationSystem_Get_BookById").DoExecute({"session_id":sessionId, "book_id":bookId});

var book = SeS("LibraryInformationSystem_Get_BookById").GetResponseBodyObject();

 

 

Returns:

 

'true' if success, 'false' otherwise.