Hi All,
I'm trying to get calls to the mod_assign_save_grade endpoint to work using REST/JSON. Other endpoints are working fine (e.g. mod_assign_get_grades), but I can't seem to get anything but the terribly unhelpful "invalid_parameter_excpetion" back from the mod_assign_save_grade endpoint.
Call
curl -X GET 'https://mymoodle.edu/webservice/rest/server.php? wstoken=<token>&moodlewsrestformat=json&wsfunction=mod_assign_save_grade& assignmentid=1&userid=4&grade=3&attemptnumber=-1&addattempt=0&workflowstate=graded&applytoall=0'
Response
{"exception":"invalid_parameter_exception","errorcode":"invalidparameter","message":"Invalid parameter value detected"}
I am providing all of the arguments marked as required in the docs. Anyone see the issue?
Also, a few points that aren't clear from the docs:
- What is the 'addattempt' parameter for? What should it be set to if you don't care/aren't using manual attempts?
- What is the "workflowstate" parameter for? What should it be set to if not using grading workflows?
- Does the 'applytoall' parameter have any bearing if you're not using groups?
Also, is there any logging on the Moodle-server side of things that will provide more details about why WS requests get rejected with the generic "invalid_paramter_excpetion"? There must be better ways to inform developers about what's going wrong...
Anyone have any ideas or can point me at soem working mod_assign_save_grade code (I can't find any uses on github)? Despite teh CURL example above, I'm actually trying to hit this endpoint via a python-requests script. But I get the same result via curl.
I'm on a git pull of Moodle 2.7.1+ (Build: 20140717).