// handle the request authn if needed
 iclicker_handle_authn($cntlr);
 if ("GET" == $cntlr->method) {
     if ("courses" == $pathSeg0) {
         // handle retrieving the list of courses for an instructor
         $user_id = iclicker_get_and_check_current_user("access instructor courses listings");
         $output = iclicker_service::encode_courses($user_id);
     } else {
         if ("students" == $pathSeg0) {
             // handle retrieval of the list of students
             $course_id = $pathSeg1;
             if ($course_id == null) {
                 throw new InvalidArgumentException("valid course_id must be included in the URL /students/{course_id}");
             }
             iclicker_get_and_check_current_user("access student enrollment listings");
             $output = iclicker_service::encode_enrollments($course_id);
         } else {
             // UNKNOWN
             $valid = false;
             $output = "Unknown path ({$cntlr->path}) specified for method GET";
             $status = 404;
             //NOT_FOUND
         }
     }
 } else {
     // POST
     if ("gradebook" == $pathSeg0) {
         // handle retrieval of the list of students
         $course_id = $pathSeg1;
         if ($course_id == null) {
             throw new InvalidArgumentException("valid course_id must be included in the URL /gradebook/{course_id}");