Hi guys, I am new to moodle and I am trying to retrieve a list of courses via the web service. I followed all the instructions on enabling the web services, creating a user, roles, services, permissions, adding functions, etc.
I am calling:
http://[MOODLE_URL]/webservice/rest/server.php?wstoken=[TOKEN]&moodlewsrestformat=json&wsfunction=core_course_get_courses
But getting back
{"exception": "moodle_exception","errorcode": "errorcoursecontextnotvalid","message": "You cannot execute functions in the course context (course id:2). The context error message was: Course or activity not accessible."}
I am sure it is just some kind of permission or setting somewhere, can any point me in the correct direction?
Much appreciated