I have installed Moodle on my local machine and am investigating the REST API as part of a larger project. After following the instructions in the Web Services Plugin Overview section i was successfully able to test my token based user creating several new users.
However, when i try to use the REST API from outside of the system I encounter an "Access Control Exception" error.
For example I try to GET: http://localhost:8888/moodle21/webservice/rest/server.php?wstoken='280bc2b04426330a9d683383662ff58b'&wsdl=1
I'm expecting an error, but not this in response:
<?xml version="1.0" encoding="UTF-8" ?>
<MESSAGE>Access control exception</MESSAGE>
It seems like there's a problem with the same token that i can successfully use through the test client within the administration section of Moodle. I checked the server log and i see the following:
Failed to log: '280bc2b04426330a9d683383662ff58b' - 0:0:0:0:0:0:0:1
After checking through the code i figured out that this could either be caused by an error on a restricted IP address or simply by the tokens stored in the db not matching the one passed in the URL. I don't have any IP restrictions set up and this token does match what's in the db.
As i have never made a REST-based API call before it may be a problem with an improperly formed call -- can anyone help?