Moodle Plugins directory: Webservice get roles: Versions: v0.9.0.1 | Moodle.org
Webservice get roles
Webservice get roles v0.9.0.1
Moodle WebService Get Roles (wsgetroles)
This local plugin allows you to get moodles roles via REST API. There is no possibility to get role ids directly via rest api, though there are two core functions demanding for role id: core_role_assign_roles and core_role_unassign_roles.
The function local_wsgetroles_get_roles is added to the rest api. You can give over lists of roleids, rolenames and/or roleshortnames and get the associated roleinformations (id, name, shortname, description, sortorder, archetype). If the given id, name, shortname has no corresponding role, roleinfomations will be "null" despite of the search entry. If you give over empty lists all roles will be returned.
Some example calls to the webservice function:
Get all roles: https://yoursite.com/webservice/rest/server.php?wstoken=yOurT0k3n&moodlewsrestformat=json&wsfunction=local_wsgetroles_get_roles
Get roles with id=1, id=2 or shortname=editingteacher: https://yoursite.com/webservice/rest/server.php?wstoken=yOurT0k3n&moodlewsrestformat=json&wsfunction=local_wsgetroles_get_roles&ids[0]=1&ids[1]=2&shortnames[0]=editingteacher
Get role with name=Teacher: https://yoursite.com/webservice/rest/server.php?wstoken=yOurT0k3n&moodlewsrestformat=json&wsfunction=local_wsgetroles_get_roles&names[0]=Teacher
Configuration
No configuration needed, just install the plugin. Keep in mind to add the functions to the rest-service.
Usage
Use functions over Rest API.
Requirements
- Moodle 3.3 or later
Installation
Copy the wsgetroles folder into your /local directory. Add the functions to your rest-service.
Author
Corvus Albus
Version information
- Version build number
- 2020073000
- Version release name
- v0.9.0.1
- Maturity
- Stable version
- MD5 Sum
- 1d89d4e2940523beb29f068f1c85d169
- Supported software
- Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6, Moodle 3.7, Moodle 3.8, Moodle 3.9
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.3
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.4
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.5
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.6
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.7
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.8
- The more recent release v0.9.0.2 (2023042402) exists for Moodle 3.9
Version control information
- Version control system (VCS)
- GIT
- VCS repository URL
- VCS branch
- master
- VCS tag
- v0.9.0.1
Default installation instructions for plugins of the type Local plugins
- Make sure you have all the required versions.
- Download and unpack the module.
- Place the folder in the "local" subdirectory.
- Visit http://yoursite.com/admin to finish the installation.