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

RESTService

Top  Previous 

Behavior Pattern: RESTServiceBehavior

 

Property Summary

 

Property

Description

Getter

Setter

Name

The name of the request operation

GetName

Method

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

GetMethod

SetMethod

Credential

The HTTP Basic Authentication Credentials (if any)

GetCredential

SetCredential

Url

The URL being used to access the web service

GetUrl

SetUrl

Parameters

The list of parameters available for this request url

GetParameters

RequestHeaders

The list of HTTP headers that are part of this request

GetRequestHeaders

SetRequestHeaders

RequestBodyText

The body of the HTTP request in raw text format

GetRequestBodyText

SetRequestBodyText

RequestBodyObject

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

GetRequestBodyObject

SetRequestBodyObject

ResponseIsErrorStatus

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

GetResponseIsErrorStatus

ResponseHeaders

Returns the list of HTTP headers returned from the HTTP response

GetResponseHeaders

ResponseBodyText

The body of the HTTP response in raw text format

GetResponseBodyText

ResponseBodyObject

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

GetResponseBodyObject

 

Action Summary

 

Action

Description

DoExecute

Executes the web service operation

 

Property Detail

 

Name

The name of the request operation

Accessors: GetName

Method

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

Accessors: GetMethod, SetMethod

Credential

The HTTP Basic Authentication Credentials (if any)

Accessors: GetCredential, SetCredential

Sample Code:

    var credential = {};
    credential.UserName = 'fredbloggs';
    credential.Password = 'MyPassword';
    SeS('Operation_Name').SetCredential(credential);
                

 

Url

The URL being used to access the web service

Accessors: GetUrl, SetUrl

Parameters

The list of parameters available for this request url

Accessors: GetParameters

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;
    }
                

 

RequestHeaders

The list of HTTP headers that are part of this request

Accessors: GetRequestHeaders, SetRequestHeaders

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;
    }
                

 

RequestBodyText

The body of the HTTP request in raw text format

Accessors: GetRequestBodyText, SetRequestBodyText

RequestBodyObject

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

Accessors: GetRequestBodyObject, SetRequestBodyObject

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});
                

 

ResponseIsErrorStatus

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

Accessors: GetResponseIsErrorStatus

ResponseHeaders

Returns the list of HTTP headers returned from the HTTP response

Accessors: GetResponseHeaders

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;
    }
                

 

ResponseBodyText

The body of the HTTP response in raw text format

Accessors: GetResponseBodyText

ResponseBodyObject

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

Accessors: GetResponseBodyObject

Sample Code:

    SeS('LibraryInformationSystem_Get_BookById').DoExecute({'session_id':sessionId, 'book_id':bookId});
    var book = SeS('LibraryInformationSystem_Get_BookById').GetResponseBodyObject();
                

 

Action Detail

 

DoExecute(bcheck)

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

Parameters:

Name

Type

Description

params

JavaScript object {"name1": "value1", "name2": "value2" }

Parameter values that should be passed to the web service operation. Passed as a JavaScript object.

Returns:

'true' if success, 'false' otherwise.

Sample Code:

    SeS('LibraryInformationSystem_Get_BookById').DoExecute({'session_id':sessionId, 'book_id':bookId});
    var book = SeS('LibraryInformationSystem_Get_BookById').GetResponseBodyObject();