rbf_invokeSystemRESTAPI()
Purpose
Platform client-side API to provide end-users the ability to invoke Platform REST APIs on the same instance from a logged in UI session.
Note: This API is available only in New UI pages.
Syntax
rbf_invokeSystemRESTAPI(restMethod, httpMethod, headers, params, body, options)
Parameters
restMethod
The rest method. This function argument is mandatory. See Platform REST Methods for more information on rest methods.
httpMethod
The HTTP method. This function argument is mandatory. The POST, GET, PUT, and DELETE HTTP Methods are supported.
headers
The JSON object with key-value pairs to be forwarded as HTTP Request headers.
params
The JSON object with key-value pairs, wherein, each entry denotes HTTP Request parameter name and parameter value.
body
The request payload as serialized string literal.
options
The JSON object with additional optional arguments as properties.
| Property Name | Description |
|---|---|
| callback | Callback function handler. This API has asynchronous behavior. The service response is passed as an JSON object (function argument) to this callback function. This JSON object encapsulates the response status code, headers, and payload. |
| errorCallback | The error details will be passed as arguments to this error callback handler. If this callback handler is not configured, use the global error handler function 'rbv_errorsCallback'. |
| userName | On Platform server side, while establishing HTTP connection to RESTful Service host, Platform supports HTTP Basic Authentication. You must pass the user-name details as this property value. You can also set Platform token as the property value. The Platform token will be resolved and used in the Authorization header of the HTTP request. |
| password | On Platform server side, while establishing HTTP connection to RESTful Service host, Platform supports HTTP Basic Authentication. You must pass password as this property value. You can also set Platform token as property value. The Platform token will be resolved and used in the Authorization header of the HTTP request. |
| httpReadTimeout | This property configures socket read timeout for the HTTP connection in milliseconds. That default value is 2 minutes. However, this can be configured to a maximum of 8 minutes. |
| debug | This property logs debug messages (tenant specific) on Platform server-side, while relaying service request and response. |
| timeout | This property configures AJAX call timeout in milliseconds. The default value is 5 minutes. However, this can be configured to a maximum of 15 minutes using this property. On exceeding this period, AJAX call will timeout and result in a timeout error response. |
Note: This API is supported in portals as well.
Example
<script>
rbf_addOnLoadMethod(onLoad);
function onLoad() {
var params = {};
params.objName = 'detSearch';
var body = '<?xml version="1.0" encoding="utf-8" ?>
<data objName="detSearch" useIds="false">
<Field name="name">detSearch_script_create_1</Field></data>';
rbf_invokeSystemRESTAPI('create', 'POST', null, params, body, {'callback':function(response)
{ console.log(response);} }) }
</script>