I have LMS Moodle In that, I am using Moodle API by php curl
1) I have Created a User role and assign permission to that role.
2) Create user and assign that user to a created role
3) also create External Service by that user.
4) after that generate a token to access API
I am able to create a course by that generated token
but unable to update course and getting an error "core_course_update_courses: accessexception Access control exception"
I am using core_course_update_courses
I am Using curl class
Api endpoint url
require_once( 'curl.php' );
$course = new stdClass();
$course->id = $course_id;
$course->fullname = 'testcourseupdate' . $n;
$course->shortname = 'testcourseupdate' . $n;
$course->categoryid = 3;
$courses = array( $course );
$params = array( 'courses' => $courses );
$curl = new curl;
$response = $curl->post( $serverurl, $params );
Getting error Response from core_course_update_courses: accessexception Access control exception
please provide me with some suggestions.