Course Completion API

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:

  1. Required Parameters:
    • courseid= int (Required: The numeric ID of the course.)
    • userid= int (Required: The numeric ID of the user.)

cURL Command Example (Getting Activity Status):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_completion_get_activities_completion_status" \
-d "courseid=789" \
-d "userid=123"



core_completion_get_course_completion_status

This function checks the overall completion status of an entire course for a specific user.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • courseid= int (Required: The numeric ID of the course.)
    • userid= int (Required: The numeric ID of the user.)

cURL Command Example (Getting Course Status):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_completion_get_course_completion_status" \
-d "courseid=789" \
-d "userid=123"



core_completion_override_activity_completion_status

This function allows you to manually set or override the completion status of a specific activity for a user.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • userid= int (Required: The numeric ID of the user.)
    • cmid= int (Required: The unique course module ID for the specific activity.)
    • newstate= int (Required: The new completion state. Use 0 for 'Incomplete' or 1 for 'Complete'.)

cURL Command Example (Overriding Activity Status):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_completion_override_activity_completion_status" \
-d "userid=123" \
-d "cmid=567" \
-d "newstate=1"