Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

RestServer

  • Last UpdatedFeb 19, 2025
  • 5 minute read

The RestServer node allows you to create a REST HTTP service and configure it.

Restserver is a single use node. Therefore, only one instance should be declared in a project. It supports communication over HTTP and HTTPS.

Platform support

This node is fully supported on XR-Windows platform.

It is partially supported on XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.

The portable platforms do not support getimage and capture functions.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Partial support

Partial support

Partial support

Partial support

Full support

Limited support

Limited support

Limited support

Limited support

Message.webport parameter

In order to create the server, the RestServer node must be declared and the config parameter Message.webport must be set to 10667.

If Message.webport is set to -1 the RestServer will not create the HTTP server at startup. There is no way to create the HTTP server at runtime.

Certificates

Rest Server node supports certificates for HTTPS. Contact your IT infrastructure team to get a SSL certificate or you can create a self-signed SSL certificate (not recommended) for testing purposes.

  • Installing SSL Certificate to Personal Certificates Store on machine where Rest Server is running.

  • Installing SSL Certificate/Root certificate to Trusted Root Certification Authorities Store on client machine that is going to communicate with Rest Server.

Detailed steps to create a self signed certificate and installing it on to server and client are available here.

Commands

The RestServer can support various commands and will answer to GET calls if the commands are registered in the service.

Commands

Usage

capture

capture w=<width> h=<height> t=<t> o=<o> i=<i>

enumeratefields

enumeratefields pars=<fieldname,all|action>

enumeratenodes

enumeratenodes pars=<all|items>

getimage

getimage name=<image name> w=<width> h=<height> t=<t> o=<o> i=<i>

getlocal

getlocal name=<fieldName> evaluate=<true|false>

getlocals

getlocals names=<fieldNames comma separated> evaluate=<true|false>

setlocal

setlocal name=<fieldName> value=<fieldvalue>resolve=<true|false>

help

lists all commands

json/getlocal

json/getlocal name=<fieldName>

json/setlocal

json/setlocal name=<fieldName> value=<fieldvalue>resolve=<true|false>

setaction

item=<item> action=<action> state=<started|stopped>

upload

upload name=<file name> (This command is not actually doing anything, present for legacy reasons)

For example, to get an internal value you can access the application from a browser with an URL such as:

http://localhost:10667/getlocal?name=nodeName.fieldName

Or to get the list of all registered commands in the service you can make this call:

http://localhost:10667/help

White List filtering

You can use the whiteList dictionary to restrict the data that is get and set by the calls.

  • Any command that gets values (getlocal, getlocals, json/getlocal, getimage) will respond with the requested values only if the requested names are present in the list in the "get" key of this dictionary.

  • Any command that sets values (setlocal, setaction, json/setlocal) will set the field only if the specified names are present in the list in the "set" key of this dictionary.

For example:

{get=nodeName.fieldName,textureName}{set=itemName.action\actionName}

In this example, external callers will be able only to:

  • Get nodeName.fieldName value using getlocal, json/getlocal or getlocals.

  • Get the texture textureName using getimage.

  • Set the action state of the itemName action called "actionName" using setaction.

    Note: If the dictionary is not specified, no white list filtering is applied. If no {get=} key is defined, all fields in the project can be read using the REST service.

Remote Debugger

By setting remoteDebug to true, the RestServer node enables XR Remote Debugger to access project data.

For security reasons, the remoteDebug field cannot be changed during runtime and its use should be restricted to the project development phase for testing on portable devices.

Note: There must be only one XR Remote Debugger instance connecting the application and using the RestServer node. 

Debug commands

This is the list of debug commands provided by RestServer.

Commands

Usage

debug/supported

Checks if debug is active.

debug/general

Returns Debug general tab data.

debug/defines

Return the list of defines with their values.

debug/evaluate

The command debug/evaluate text=<text-to-evaluate> performs data resolution.

debug/routes

Returns the list of routes

debug/nodes

Return the three of nodes.

debug/getnode

The command debug/getnode name=<node to select> returns list of node properties.

debug/setfield

The command debug/setfield name=<fieldName> value=<fieldvalue> is used to update a node field.

debug/logs

Returns the latest log lines.

debug/renderstatspopulate

Returns render stats keys and its related parameter names.

debug/renderstatsdata

The command debug/renderstatsdata name=<nodename> parent=<nodeparent> returns a list of stat-related parameters with real time values.

debug/completeprofilerdata

Returns all render stats parameters with real time values.

Code example

This is a code example for the RestServer node.

<RestServer name="rstSrvr" registeredCommands="getlocal,setlocal" active="false" whiteList="{get=omniDefault.attenuationEnd}{set=omniDefault.attenuationEnd,itemName.action}" />

RestServer fields

These are the fields for RestServer node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > RestServer

Fields

Type

Use

Default value

Description

active

sbool

Optional

true

Starts (true) and stops (false) the HTTP service.

circuitBreaker

dstring

Optional

Not set

Enable an additional feature of the rest server to suspend service for a given time if the number of exception triggered by calls in a given time exceeds a chosen value. Values can not be changed at runtime.

  • enable: Activates/deactivates service.

  • numOfEx: Number of Exception that the system can handle.

  • retainSec: Time on consecutive exception that the system can handle.

  • suspendSec: Time of service suspension once that the thresholds are exceeded.

Example:

circuitBreaker="{enable=True}{numOfEx=8}{retainSec=2.5}{suspendSec=3.5}"

registeredCommands

mstring

Optional

Not set

List of registered commands. These are not modifiable at runtime. Possible commands supported are listed in Commands section and can be checked on the service using the help command.

If the registeredCommands field is left empty (default) all available commands will be registered.

The help command is always registered, even if not present in this list.

remoteDebug

sbool

Optional

false

Activates the functionality required by the XR RemoteDebugger tool. It cannot be used during runtime.

setupSSL

sfunction

Optional

Not set

Input: SSL certificate path and certificate password with comma separated.

D:\MyFolder\MySSLCert.pfx,Passw0rd!

Rest Server by default runs without certificate and runs as HTTP.

Executing this function restarts Rest Server and runs with certificate(HTTPS)

whiteList

dstring

Optional

Not set

You can use the whiteList dictionary to restrict the data that is get and set by the calls.

TitleResults for “How to create a CRG?”Also Available in