Hi All,
I'm having issues with using Python to access my Web Services API - here's my code:
import requests,json
token = 'mytoken'
domainname = 'http://mymoodleserver'
functionname = 'core_user_get_users_by_field'
restformat = 'json'
restformat = '&moodlewsrestformat='+restformat
serverurl = domainname+'/webservice/rest/server.php'+'?wstoken='+token+'&wsfunction='+functionname+restformat
user1 = {'field':'email','values':['jeff@abc.com']}
myuser = requests.post(serverurl,json=json.dumps(user1))
The error that comes back is:
{"exception":"invalid_parameter_exception","errorcode":"invalidparameter","message":"Invalid parameter value detected (Missing required key in single structure: field)","debuginfo":"Missing required key in single structure: field"}
Any suggestions where I'm going wrong? I've tried various permutations & combinations.
Thanks in advance,
Jeff