Deleting course enrollments via web service

Deletion of a course_enrollment record via web services removes all related learner content, including the course_report record, course_outline_fulfillment records, and course_credit_awarded records. It will also cascade deletions to the child enrollments if deleting the parent course of a course relationship.

$curl = curl_init("http://your-domain.com/course_enrollment/1234"); // Note the 1234, which is the enrollment id of the course_enrollment entity record curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "restws_webservice:webservice_password"); //Your credentials goes here curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); print 'Deleting...'; $json = curl_exec($curl); $cinfo = curl_getinfo($curl); $response = json_decode($json); if($cinfo['http_code'] == 200 && empty($response)){ print 'The entity has been deleted'. }