Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2361

Unable to Update Course by Api Function core_course_update_courses

$
0
0
by Gaurav K.  

Hello

I have LMS Moodle In that, I am using Moodle API by php curl
For that,
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
https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

Api endpoint url
$serverurl ="https://elearning.tsfx.com.au/webservice/rest/server.php?wstoken=api_token&wsfunction=core_course_update_courses";

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.


Viewing all articles
Browse latest Browse all 2361

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>