Role REST API

Functions:#


loadChildren#

URL: /api/role/loadchildren/

Returns a JSON representation of the Role with the given id, including its first level children.

The role (parent) node contains the attributes: id, name, locked, children.

  • id: id of the role
  • name: name of the role
  • locked: boolean that indicates if the role is locked
  • children: a list of the role's first level children

Each child node contains the attributes: id, name, locked, children.

  • id: id of the child role
  • name: name of the child role
  • locked: boolean that indicates if the child role is locked
  • children: boolean that indicates if the child role has children

Parameters:#

id: (Optional) id of the role. If not passed, the function returns the root node (not a role) and its children (root roles)

Usage: /api/role/loadchildren/id/<id>

Example usage 1: /api/role/loadchildren/id/2adccac3-a56b-4078-be40-94e343f20712

Example usage 2 (Root Roles): api/role/loadchildren/

user/password*: (Optional) Specifies a username/email and password to use to authenticate.

Usage: /api/role/loadchildren/id/<id>/user/<username-or-email>/password/<password>

Example usage: api/role/loadchildren/id/2adccac3-a56b-4078-be40-94e343f20712/user/admin/password/admin

loadById#

URL: /api/role/loadbyid/

Returns a JSON representation of the Role with the given id.

The resulting role node contains the following fields:

DBFQN, FQN, description, editLayouts, editPermissions, editUsers,

id, locked, name, parent, roleKey, system. See http://dotcms.com/docs/2.1/javadocs/com/dotmarketing/business/Role.html

Parameters:#

id: (mandatory) id of the role to be loaded.

Usage: /api/role/loadbyid/id/<id>

Example usage: /api/role/loadbyid/id/2adccac3-a56b-4078-be40-94e343f20712

user/password*: (Optional) Specifies a username/email and password to use to authenticate.

Usage: /api/role/loadbyid/id/<id>/user/<username-or-email>/password/<password>

Example usage: api/role/loadbyid/id/2adccac3-a56b-4078-be40-94e343f20712/user/admin/password/admin

loadByName#

URL: /api/role/loadbyname/

Returns a JSON tree structure whose leaves names contain the given "name" parameter.

Each node contains the fields: id, name, locked, children.

  • id: id of the child role
  • name: name of the child role
  • locked: boolean that indicates if the child role is locked
  • children: list of the role's first level children, if any.

Parameters:#

name: (mandatory) id of the role to be loaded.

Usage: /api/role/loadbyname/name/<name>

Example usage: /api/role/loadbyname/name/system

user/password*: (Optional) Specifies a username/email and password to use to authenticate.

Usage: /api/role/ loadbyname /name/<name>/user/<username-or-email>/password/<password>

Example usage: api/role/loadbyname/name/system/user/admin/password/admin

*when the user/password combination is not provided, you need to have a valid user logged on to either the front-end or back-end.

    Roles | dotCMS Dev Site