Skip to content

Widgets API

Modules add small templates (widgets) to named slots of the admin and client pages, such as admin.index.dashboard. These calls list the registry of slots and widgets and rebuild it. See Widget Registry.

Admin calls need Module access on the Widgets card of the staff group’s Permissions tab, plus each call’s own permission below (Super Administrators have all). See Authentication.

POST /api/admin/widgets/list

Lists every slot that has widgets, sorted by slot name, with its widgets in the order they show.

Permission: View widgets (widgets.view)

No parameters.

Returns: A list of slots, each with slot (the name), count and widgets (each with module, template and priority; lower numbers show first, default 10).

Example

Request parameters:

{}

result:

[
{
"slot": "admin.index.dashboard",
"count": 1,
"widgets": [
{
"module": "clientfence",
"template": "mod_clientfence_dashboard_support",
"priority": 10
}
]
}
]

POST /api/admin/widgets/rebuild

Rebuilds the widget registry from the active modules (the Rediscover Widgets button). Activating or deactivating a module already does this.

Permission: Manage widgets (widgets.manage)

No parameters.

Returns: true