Skip to content

Themes API

A theme is a folder of templates and assets; the client area and the admin area each use one. A theme with a settings page keeps its settings in named presets. See Client theme and Create a theme.

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

POST /api/admin/theme/get_list

Lists the installed client area themes (theme folders whose name does not contain admin).

Permission: View themes (theme.view)

No parameters.

Returns: {list}: each theme as in get.

A theme whose manifest cannot be read is left out.

POST /api/admin/theme/get_admin_list

Lists the installed admin area themes (theme folders whose name contains admin).

Permission: View themes (theme.view)

No parameters.

Returns: {list}: each theme as in get.

POST /api/admin/theme/get_current

Returns the active client area theme, or the active admin area theme. When the selected theme’s folder is missing, the default theme (Palisade, or the standard admin theme) is returned.

Permission: View themes (theme.view)

Parameter Type Description
client boolean true (default) for the client area theme, false for the admin area theme.

Returns: The theme, as in get.

Errors:

  • Invalid “client” parameter. (code 9999) when client is not a true/false value

POST /api/admin/theme/get

Returns one theme’s details.

Permission: View themes (theme.view)

Parameter Type Description
code string, required The theme’s folder name, such as palisade or admin_default.

Returns: The fields of the theme’s manifest (name, version, description, author, author_url and any others it has, such as icon), plus code, url (the theme’s web address), paths (the template folders on the server, used to find templates) and hasSettings (whether it has a settings page).

Errors:

  • Theme was not found in path … (code 9999)
  • Unable to decode theme manifest file … (code 9999)
Example

Request parameters:

{
"code": "palisade"
}

result:

{
"name": "Palisade",
"version": "1.0.0",
"description": "Palisade, the ClientFence client area theme: English and Arabic (RTL), light and dark.",
"author": "ClientFence",
"author_url": "https://clientfence.com/",
"url": "https://billing.example.com/themes/palisade/",
"code": "palisade",
"paths": [
"/var/www/billing/themes/palisade/html",
"/var/www/billing/modules/Client/templates/client"
],
"hasSettings": true
}

POST /api/admin/theme/select

Makes a theme the active one. A theme whose code contains admin_ becomes the admin area theme; any other becomes the client area theme.

Permission: Manage themes (theme.manage)

Parameter Type Description
code string, required The theme’s folder name.

Returns: true.

Errors:

  • Theme ‘mytheme’ does not exist. (code 9999)

POST /api/admin/theme/preset_delete

Deletes a preset’s saved settings of a theme. When it was the current preset, the theme goes back to the preset its settings file names as current.

Permission: Manage themes (theme.manage)

Parameter Type Description
code string, required The theme’s folder name.
preset string, required The preset name.

Returns: true, also when no preset has that name.

Errors:

  • Theme ‘mytheme’ does not exist. (code 9999)

POST /api/admin/theme/preset_select

Makes a preset the theme’s Current Preset.

Permission: Manage themes (theme.manage)

Parameter Type Description
code string, required The theme’s folder name.
preset string, required The preset name.

Returns: true.

Errors:

  • Theme ‘mytheme’ does not exist. (code 9999)

The name is not checked against the theme’s presets.