I am trying to add users to Moodle from an external system via the REST API.
I have follow the directions on this page under 'Allow an external system to control Moodle': https://www.yourmoodle.com/moodle/admin/category.php?category=webservicesettings
I actually took screenshots of all the completed steps to prove it but now I see that the forum only allows 2 attachments per message so I will add the first 2 to this message and provide others on request.
When I run the code from the external system to try to add a user to Moodle, I get this message back:
<?xml version="1.0" encoding="UTF-8" ?> <EXCEPTION class="moodle_exception"> <ERRORCODE>invalidtoken</ERRORCODE> <MESSAGE>Invalid token - token not found</MESSAGE> </EXCEPTION>
This is also the exact same message I get in my browser when I enter the URL https://www.yourmoodle.com/webservice/rest/server.php?wstoken=[the token]
I am using the token I created for the web service user for that specific service. The same token also appears in my browser window when I enter https://www.yourmoodle.com/login/token.php?username=USERNAME&password=PASSWORD&service=SERVICESHORTNAME so it's got to be the right token.
I have been trying to get this to work for over 24 hours now and I feel I have exhausted all avenues, I have tripled-checked my settings, I have googled like mad, I have a headache, and I'm concerned about what I'm going to tell my boss on Monday if this doesn't get sorted, so I will be eternally grateful if anyone can shed any light on this.