Moodle Plugins directory: Webservice functions for cohort enrolment: Versions: v3.3.3 | Moodle.org
Webservice functions for cohort enrolment
Webservice functions for cohort enrolment v3.3.3
Moodle Webservices for Cohort Enrolment.
- What is this plugin and why was it developed?
- What can this plugin do?
- What else can this plugin do?
- What can this plugin not do?
- How do I install this plugin?
- What version of Moodle can I install this on?
- How do I use this plugin?
- Examples JSON responses
What is this plugin and why was it developed?
This is a local plugin with webservice functions.
It was developed for Te Wānanga O Aotearoa to streamline the enrolment of tauira (student, learner) into courses. Cohorts and courses are created using Moodle webservices but adding cohort enrolment instances to courses was a manual process.
The overall goal is to have this webservice function integrated into Moodle core.
What can this plugin do?
This local plugin enables people to add a cohort enrolment instance to a course using webservices.
What else can this plugin do?
In addition to adding a cohort enrolment instance to a course using webservices, this plugin can also:
- Delete an existing cohort enrolment instance
- Update an existing cohort enrolment instance
- The name of the cohort enrolment instance
- The status of the cohort enrolment instance (i.e. active or inactive)
- The role that the users of the cohort enrolment instance is synchronised with
- The group that users of the cohort enrolment instance are added to (i.e. create a new group, an existing group that belongs to the course, none)
 
- Get a list of all cohort enrolment instances
- Get a list of cohort enrolment instances for a specific course
What can this plugin not do?
This plugin can not do anything that is not listed under What can this plugin do? or What else can this plugin do?
How do I install this plugin?
This plugin can be installed by following the official Moodle documentation.
What version of Moodle can I install this on?
This plugin has only been developed and tested for Moodle 3.3.
How do I use this plugin?
This plugin can be used in accordance with the official Moodle documentation.
Example JSON responses.
This is an example of a JSON response to the webservice function get_instances().
{
     "id": -1,
     "code": 200,
     "message": "Found 0 cohort enrolment instances in 2 courses (All courses).",
     "data": []
 }
Here are some example JSON responses to the webservice function add_instance().
{
      "exception": "local_ws_enrolcohort\\exceptions\\cohort_not_found_exception",
      "errorcode": "objectnotfound",
      "message": "Object does not exist!",
      "debuginfo": "Could not find cohort with id 2"
  }
{
      "id": 24,
      "code": 201,
      "message": "Cohort enrolment instance added.",
      "data": [
          {
              "object": "course",
              "id": 2,
              "name": "TestCourse1",
              "idnumber": "",
              "shortname": "TestCourse1",
              "visible": 1,
              "format": "topics"
          },
          {
              "object": "cohort",
              "id": 4,
              "name": "Test",
              "idnumber": "1",
              "visible": 1
          },
          {
              "object": "role",
              "id": 1,
              "shortname": "manager"
          },
          {
              "object": "data",
              "name": "",
              "cohortid": 4,
              "roleid": 1,
              "groupid": 0,
              "status": 0
          },
          {
              "object": "group",
              "id": 0,
              "name": "Enrol instance group none.",
              "courseid": -1
          },
          {
              "object": "enrol",
              "id": 24,
              "name": "Cohort sync (Test - Manager) - Using system generated name.",
              "courseid": 2,
              "cohortid": 4,
              "roleid": 1,
              "groupid": 0,
              "status": 0
          }
      ]
  }
Version information
- Version build number
- 2019042900
- Version release name
- v3.3.3
- Can be updated from
- v3.3-r1, v3.3-r1 (2018041901), v3.3.2 (2018110600)
- Maturity
- Stable version
- MD5 Sum
- 8c8b828fc4fe7da7d1d248b6781c45d3
- Supported software
- Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6
- The more recent release v3.3.4 (2022062800) exists for Moodle 3.3
- The more recent release v3.3.4 (2022062800) exists for Moodle 3.4
- The more recent release v3.3.4 (2022062800) exists for Moodle 3.5
- The more recent release v3.3.4 (2022062800) exists for Moodle 3.6
 
Version control information
- Version control system (VCS)
- GIT
- VCS repository URL
- VCS branch
- master
- VCS tag
- v3.3.3
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.