Course Groups API

Course Groups API

core_group_add_group_members

This function adds one or more users to a specific group within a course.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • members[0][groupid]= int (Required: The numeric ID of the group.)
    • members[0][userid]= int (Required: The numeric ID of the user to add to the group.)

cURL Command Example (Adding a Group Member):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_group_add_group_members" \
-d "members[0][groupid]=33" \
-d "members[0][userid]=123"



core_group_delete_group_members

This function removes one or more users from a specific group.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • members[0][groupid]= int (Required: The numeric ID of the group.)
    • members[0][userid]= int (Required: The numeric ID of the user to remove from the group.)

cURL Command Example (Removing a Group Member):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_group_delete_group_members" \
-d "members[0][groupid]=33" \
-d "members[0][userid]=123"



core_group_create_groups

This function creates one or more new groups within a specified course.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • groups[0][courseid]= int (Required: The numeric ID of the course where the group will be created.)
    • groups[0][name]= string (Required: The name of the new group.)
    • groups[0][description]= string (Required: A description for the group.)
  2. Optional Parameters:
    • groups[0][descriptionformat]= int (Optional: The text format. 1 = HTML, 2 = Plain, 4 = Markdown. Defaults to 1.)
    • groups[0][idnumber]= string (Optional: A unique alphanumeric ID for the group.)
    • groups[0][enrolmentkey]= string (Optional: A password that users can use to join the group.)

cURL Command Example (Creating a Group):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_group_create_groups" \
-d "groups[0][courseid]=789" \
-d "groups[0][name]=Project Team Alpha" \
-d "groups[0][description]=The first project team for the capstone assignment." \
-d "groups[0][idnumber]=PROJ-ALPHA"



core_group_delete_groups

This function deletes one or more groups based on their IDs.

Let's review the POST parameters for this function:

  1. Required Parameter:
    • groupids[0]= int (Required: The numeric ID of the group to delete. Pass multiple to delete more than one.)

cURL Command Example (Deleting a Group):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_group_delete_groups" \
-d "groupids[0]=33"
    • Related Articles

    • Grades API

      gradereport_overview_get_course_grades This function retrieves an overview of all final course grades for a specific user. Let's review the POST parameters for this function: Optional Parameter: userid= int (Optional: The numeric ID of the user. If ...
    • Finding Pluto LMS IDs

      USER IDS To find a User ID: Go to "Site admin" → "User Management" → "View all site users", then select the applicable User Profile. The ID can be found in the browser URL: COURSE IDS To find a Course ID: Go to the applicable Course. The ID can be ...
    • Course API

      core_course_get_courses This function retrieves details about one or more courses. Let's review the POST parameters for this function: Optional Parameter: options[ids][0]= int (Optional: A numeric course ID. You can pass multiple IDs to retrieve ...
    • Course Completion API

      core_completion_get_activities_completion_status This function checks the completion status of all activities within a course for a specific user. Let's review the POST parameters for this function: Required Parameters: courseid= int (Required: The ...
    • Enrollment API

      enrol_manual_enrol_users This function manually enrols one or more users into a specified course with a specific role. Let's review the POST parameters for this function: Required Parameters: enrolments[0][roleid]= int (Required: The numeric ID for ...