Hi!
The Context:
I have a Moodle 3.x installation and right now I'm trying to integrate an external system to it. This system needs to fetch users and courses so I want to provide a web service (preferably rest) in order to allow his developers to fetch that info.
The Problem:
I followed this steps: https://docs.moodle.org/dev/Creating_a_web_service_client in order to enable the web service, so I created a user, with Manual Authentication, then a role, assigned that role to the created user, after that I created the external service, assigned the necessary capabilities, etc, etc and finally tested the web service using the tool provided in the Overview page of Web Services plugin: http://[hostname]/admin/webservice/testclient.php. It works! But here is the problem: When I try to use it from my external system (Using the curl.php script found here: https://github.com/moodlehq/sample-ws-clients), or even using a REST client (Insomnia) I get redirected to the login page instead of receiving the REST operation result. The URL that I'm using to call the REST service is: http://[hostname]/webservice/rest/server.php?wstoken=[token]&wsfunction=[function]&moodlewsrestformat=json
What I'm doing wrong? Could you help me please?
Thanks