by Michael Simpson.
So without going into the full story, I'm trying to do a quick test on our moodle server using xml-rpc
I've created an external service, assigned it the functions I want, and set my own user as the only authorised user for the service.
I've generated a token for the service.
My user has the capabilities to use the functions assigned to the service, and the xml-rpc protocols.
I wrote some quick python code just to make a test request (snippet below):
proxy = xmlrpc.client.ServerProxy(moodle_url)
username = '<someuser>'
token = '<mytoken>'
user_info = proxy.core_user_get_users(token, {'criteria': [{'key': 'username', 'value': username}]})
However, upon execution it's spitting out the error:
<Fault 89159464: 'Invalid token - token not found | ERRORCODE: invalidtoken'>
However, the token is copy/pasted exactly as it appears on the service, it does not expire and I'm able to use it without issue for another RESTful integration that I use.
<Fault 89159464: 'Invalid token - token not found | ERRORCODE: invalidtoken'>
However, the token is copy/pasted exactly as it appears on the service, it does not expire and I'm able to use it without issue for another RESTful integration that I use.
At this point I'm not really sure which token it's expecting, (If I user the token.php endpoint with my user login details the token it returns is the same as the token I'm using) or where I'm going wrong!