Rascular WebCentre: Using UserData

WebCentre’s UserData store is a centralised dictionary object which can be accessed via a REST API, allowing web panels and other systems to share, store and retrieve arbitrary text objects held on the WebCentre server.

Viewing UserData

Administrators can view, add, edit and delete UserData directly in WebCentre from the /userdata URL.

Accessing UserData from panel scripts

UserData can be retrieved using Javascript from a WebPanel.

let data = await H.RootPanel.getUserdata("DATA_KEY")

Note that the data is retrieved asynchronously, so we must await the result. Unfortunately we can’t easily handle this from Lua, so JavaScript must be used.

You can retrieve the entire UserData table as an array

let data = await H.RootPanel.getUserdata()

To create or update UserData, use setUserdata(). Objects and arrays are converted to JSON before storage, but they’re returned as strings.

H.RootPanel.setUserdata("DATA_KEY", value)

Accessing UserData via REST API

To access WebCentre UserData from third-party systems, use standard REST GET/POST/DELETE methods on the /api/userdata endpoint.