Skip to content

REST API

Finnegan's Owner edited this page Dec 2, 2026 · 3 revisions

REST API

Everything the role manager UI does goes through a REST API, so roles, user assignments, and permission lookups can all be scripted. The base path is:

/api/extensions/rbac

Interactive Documentation

Full endpoint documentation, including request/response schemas and the ability to try calls live, is available through OIE's built-in Swagger UI. Look for the Role-Based Access Control tag.

Authentication

All requests require OIE credentials. Use HTTP Basic Authentication or session-based authentication, consistent with other OIE API calls, and send the X-Requested-With header the engine's API expects. Requests and responses are available as JSON or XML.

Permissions

The plugin declares two extension permissions of its own:

Permission Grants
View Roles Read access: list and fetch roles, look up user assignments, browse the permission catalog
Manage Roles Write access: create, update, and delete roles; assign and remove user roles

Two discovery endpoints, /my-permissions and /task-permissions, are whitelisted for every authenticated user because the client UI needs them before it knows what the user holds. Users assigned to the admin role bypass permission checks entirely. Export and import (below) are the exception the other way: they need the admin role, whatever the caller's permissions.

Roles

Method Path Purpose Permission
GET /roles List all roles with their permission and channel sets View Roles
GET /roles/{roleId} Fetch one role View Roles
POST /roles Create a role Manage Roles
PUT /roles/{roleId} Update a role's name, description, permissions, and channel restrictions Manage Roles
DELETE /roles/{roleId} Delete a role Manage Roles
  • Create assigns the id from the database and always produces a non-admin role. Role names must be unique.
  • Update never changes the admin flag. Updates to the admin role must keep its full core permission set and cannot add channel restrictions.
  • Delete refuses to delete the admin role.

User Assignment

Each user holds at most one role. Assigning a new role replaces the old one.

Method Path Purpose Permission
GET /users/{userId}/role Return the role assigned to a user, or an empty 204 response if unassigned View Roles
POST /users/{userId}/role/{roleId} Assign a role to a user, replacing any prior assignment Manage Roles
DELETE /users/{userId}/role Remove the user's role assignment; the user then holds no role and is denied every gated operation Manage Roles

Assignment and removal are checked against the admin floor: a request that would leave zero users on the admin role is refused. Since 1.4.0, assigning a role to a user id the engine doesn't have answers 404 with "No engine user has the id N." and stores nothing.

Permission Discovery

Method Path Purpose Permission
GET /permissions The full permission catalog: every core engine permission plus every registered extension permission View Roles
GET /my-permissions The calling user's effective permissions. Admins get everything; a user with no role gets an empty set Whitelisted
GET /task-permissions Task-name to permission mappings declared by installed extensions Whitelisted
GET /permissions/extensions Maps each extension permission to the plugin that publishes it, e.g. "View Thread Dump" to "Thread Viewer" View Roles

GET /permissions/extensions was added in v1.1.2. Older servers return 404 for this path.

Export and Import

Since 1.3.0. Only users holding the admin role can export or import; anyone else gets 403 with "Exporting roles needs the admin role." or "Importing roles needs the admin role.".

Method Path Purpose
GET /roles/_export?roleId=3&roleId=7 The chosen roles as a file (text/plain); with no roleId, every role but the admin role
POST /roles/_import Preview (dryRun=true, the default) or apply a file sent as a text/plain body

Import query parameters: dryRun, applyChannels (default true), matchChannelsByName (default false), and for an apply, pick (positions in the file, from 0) and planToken (from the preview). A preview of a refused file answers 200 with importable false and the reason; an apply answers 400 for a refused file or a bad pick and 409 if the roles changed since the preview. The file format, every refusal and the result's fields are in docs/role-export-format.md.

Orphaned Permissions

Since 1.4.0. Only users holding the admin role can list or remove orphaned permissions, the grants roles hold that no installed plugin registers.

Method Path Purpose
GET /roles/_unregistered The orphaned permissions, by role, and the installed plugins that are disabled; never the engine's own permissions
POST /roles/_unregistered/_remove Remove the grants sent in the body, in one step; each is removed only if it is still orphaned

Example: List Roles

curl -u admin:yourpassword \
  -H "X-Requested-With: OpenIntegrationEngine" \
  https://localhost:8443/api/extensions/rbac/roles

Add -k if the server uses a self-signed certificate. Set Accept: application/json or Accept: application/xml to pick the response format.

Example: Create a Role

POST an XStream-serialized Role to /roles with Content-Type: application/xml:

<com.diridium.rbac.Role>
  <name>Interface Operators</name>
  <description>Dashboard and message access for the interface team</description>
  <permissions>
    <string>viewDashboard</string>
    <string>viewChannels</string>
    <string>viewMessages</string>
  </permissions>
  <channelIds>
    <string>2fbb1cc5-3a44-4d21-b6c2-7e0a4f9d8e11</string>
  </channelIds>
  <restricted>true</restricted>
  <isAdmin>false</isAdmin>
</com.diridium.rbac.Role>
  • Omit <id>. The database assigns it, and the response body is the persisted role with its new id.
  • <permissions> holds one <string> per grant: core permission identifiers or extension permission display names. GET /permissions returns the valid values.
  • <channelIds> is a channel whitelist, one channel id per <string>, and <restricted> (since 1.3.0) says whether it applies: true means the role sees only the listed channels, possibly none; false means every channel. A role sent with channel ids and no <restricted> is stored restricted, so older callers keep their meaning.
  • <isAdmin> is ignored on create. Roles created through the API are always non-admin.

Errors

  • Missing permission - calling an endpoint without the required permission returns 403 Forbidden with the missing permission named in the reason phrase, for example Missing permission: Manage Roles.
  • Admin guard violations - a write that would weaken the admin role or leave the server without an admin returns 400 Bad Request with a plain-text message, for example Cannot delete the admin role or Cannot remove the role assignment from the last admin user; assign another admin first.

Clone this wiki locally