Hi there,
I am writing a PHP script to create Moodle users and enrol them into courses if required. (Moodle 3.5)
My script is successfully calling these Moodle web services:
-
core_user_get_users_by_field
- core_user_create_users
-
core_enrol_get_enrolled_users
However when using the 'enrol_manual_enrol_users' web service function I get this error:
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://[MY_WEBSITE]/webservice/restful/server.php/enrol_manual_enrol_users` resulted in a `400 Bad Request` response:
{"exception":"webservice_access_exception","errorcode":"accessexception","message":"Access control exception"}
{"exception":"webservice_access_exception","errorcode":"accessexception","message":"Access control exception"}
I did the following checking:
- The web service 'enrol_manual_enrol_users' is correctly added to the external services I created.
NOTICE: to make API calls to Moodle I make use of the Restful Plugin provided by Catalyst (https://moodle.org/plugins/webservice_restful)
QUESTIONS:
Any idea on how to fix this issue? Is a permission/capability missing?
Thanks for your help.