Skip to content
OAOpenAppPhysical Security as a Service
Login

Scripting

The Scripting OpenAPI tag maps to execute_scripting: POST /scripting/execute with ExecuteScriptingRequest (script — Rhai/OpenApp DSL source) and ExecuteScriptingResponse (result — JSON value). The operation requires bearer_auth and, per OpenAPI, execute permission in at least one organization for the authenticated principal (no X-Org header on this route).

For script syntax, built-ins, CLI, and the interactive shell, see OpenApp Scripting reference and Getting started: Scripting.

ConcernHTTPoperationIdNotes
Execute programPOST /scripting/executeexecute_scriptingBody ExecuteScriptingRequest; response ExecuteScriptingResponse. Runs with caller permissions (see reference doc).
CapabilityPythonRust (openapp_sdk)GoTypeScript (AsyncClient)
Executeclient.scripting.execute(script=…)client.scripting().execute(...)ScriptingAPI.ExecuteScriptingNot on façade yet
Execute fileclient.scripting.execute_file(path)

Python’s execute also accepts program= as a backward-compatible alias for script; extra keyword arguments are merged into the JSON body (script remains the only documented field).

401 without a valid API key/session. 403 when the caller lacks scripting execute permission (or equivalent policy). 400 when the Rhai/runtime rejects the script. Surfaces ApiErrorResponse where applicable — see Errors & retries. Usage may count toward the scripting_executions quota key on the QuotaKey schema in OpenAPI.

out = await client.scripting.execute(script="1 + 1")
assert out.get("result") == 2

Only Python ships a filesystem helper. The other SDKs read the file and pass script in the JSON body — same wire shape, no extra endpoint.

out = await client.scripting.execute_file("setup.openapp")

The helper resolves the path, reads UTF-8, and forwards the contents as script.

ExecuteScriptingResponse is { "result": <any> } — the runtime preserves whatever JSON-shaped value the script returned. Treat it as untyped at the SDK boundary and assert / deserialize at the call site. 400 signals a Rhai parse / runtime error (the body carries an ApiErrorResponse with the failure reason); 401 / 403 signal API-key or permission issues, never script faults.

from openapp_sdk.errors import ApiError
try:
out = await client.scripting.execute(script='let xs = [1, 2, 3]; xs.len()')
except ApiError as err:
if err.status == 400:
# Rhai runtime/parse error — `err.body` carries `ApiErrorResponse`
...
raise
else:
n: int = int(out["result"])

HTTP contract: API reference · OpenAPI JSON · OpenApp Scripting