Copyright© 2008-2024 Sitevision AB, all rights reserved.
O
- script object@Requireable(value="RestApi") public interface RestApi<O>
This is a local, server-side, inbound utility to invoke the Sitevision REST API of the local site without any outgoing http connections. This utility can be used regardless of the REST API of the local site is enabled or not!
Version note! External (http connection-based) invocations of the Sitevision REST API can specify different versions
(online / offline) via the URL. This inbound utility will always use current version as of
VersionUtil.getCurrentVersion()
.
Below are two typical examples of how to use the RestApi utility to execute a GET for the "nodes" endpoint on a given JCR Node context and and process the returned javascript object.
a) Using a Node via a script variable (named "startPage") in the Sitevision Script module:
var restApi = require('RestApi'),
result;
result = restApi.get(scriptVariables.startPage, 'nodes');
if (result.statusCode >= 200 && result.statusCode < 300) {
out.println('Result: ' + JSON.stringify(result.body));
} else {
out.println('Fail: ' + result.statusMessage + '<br>' + JSON.stringify(result.body));
}
b) Using a Node via the app data (property "startPage") of a WebApp/RestApp:
...
result = restApi.get(appData.getNode('startPage'), 'nodes');
...
REST siblings note!
VersionedRestApi
.
RestAppInvoker
.
Requester
.
VersionedRestApi
,
Requester
,
RestAppInvoker
Modifier and Type | Method and Description |
---|---|
O |
delete(Node aContextNode,
String aOperationName)
Executes a DELETE endpoint of the REST API.
|
O |
delete(Node aContextNode,
String aOperationName,
Node aOperationNode)
Executes a DELETE endpoint of the REST API, targeting an instance of the context.
|
O |
delete(Node aContextNode,
String aOperationName,
Node aOperationNode,
O aOperationOptions)
Executes a DELETE endpoint of the REST API, targeting an instance of the context.
|
O |
get(Node aContextNode,
String aOperationName)
Executes a GET endpoint of the REST API.
|
O |
get(Node aContextNode,
String aOperationName,
Node aOperationNode,
O aOperationOptions)
Executes a GET endpoint of the REST API, targeting an instance of the context.
|
O |
get(Node aContextNode,
String aOperationName,
O aOperationOptions)
Executes a GET endpoint of the REST API.
|
O |
post(Node aContextNode,
String aOperationName,
O aOperationOptions)
Executes a POST endpoint of the REST API.
|
O |
put(Node aContextNode,
String aOperationName,
Node aOperationNode,
O aOperationOptions)
Executes a PUT endpoint of the REST API, targeting an instance of the context.
|
O |
put(Node aContextNode,
String aOperationName,
O aOperationOptions)
Executes a PUT endpoint of the REST API.
|
O get(Node aContextNode, String aOperationName)
REST hint! A get typically indicates a read of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodO get(Node aContextNode, String aOperationName, O aOperationOptions)
REST hint! A get typically indicates a read of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationOptions
- the operation data/parametersO get(Node aContextNode, String aOperationName, Node aOperationNode, O aOperationOptions)
REST hint! A get typically indicates a read of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationNode
- the operation Node of the contextaOperationOptions
- the operation data/parametersO post(Node aContextNode, String aOperationName, O aOperationOptions)
REST hint! A post typically indicates the creation of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationOptions
- the operation data/parametersO put(Node aContextNode, String aOperationName, O aOperationOptions)
REST hint! A put typically indicates an update of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationOptions
- the operation data/parametersO put(Node aContextNode, String aOperationName, Node aOperationNode, O aOperationOptions)
REST hint! A put typically indicates an update of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationNode
- the operation Node of the contextaOperationOptions
- the operation data/parametersO delete(Node aContextNode, String aOperationName)
REST hint! A delete typically indicates a removal of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodO delete(Node aContextNode, String aOperationName, Node aOperationNode)
REST hint! A delete typically indicates a removal of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationNode
- the operation Node of the contextO delete(Node aContextNode, String aOperationName, Node aOperationNode, O aOperationOptions)
REST hint! A delete typically indicates a removal of something.
aContextNode
- the endpoint context NodeaOperationName
- the endpoint operation name/methodaOperationNode
- the operation Node of the contextaOperationOptions
- the operation data/parametersSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2024 Sitevision AB, all rights reserved.