Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2361

Re: webservices for Assignment

$
0
0
by Laura Celentano.  

This is how I'm using the functions above:

  • First upload the file draft using core_files_upload, something like:
    • http://mymoodle/moodle/webservice/rest/server.php?moodlewsrestformat=json&wstoken=tokenvalue&wsfunction=core_files_upload&contextid=21&component=user&filearea=draft&itemid=0&filepath=/&filename=test.pdf. In its response there is the file id.
      • the problem is that there's not a web service for getting context id, we need to work on it 
  • Retrieve assignments id calling mod_assign_get_assignments
    • http://mymoodle/moodle/webservice/rest/server.php?wsfunction=mod_assign_get_assignments&moodlewsrestformat=json&wstoken=tokenvalue&courseids[0]=2
    Call mod_assign_save_submission, using as input parameter the file id  and assignment id retrieved previously
    • http://mymoodle/moodle/webservice/rest/server.php?wsfunction=mod_assign_save_submission&moodlewsrestformat=json&wstoken=tokenvalue&assignmentid=1&plugindata[onlinetext_editor][text]=sometext&plugindata[onlinetext_editor][format]=1&plugindata[onlinetext_editor][itemid]=draftfileid&plugindata[files_filemanager]=draftfileid
  • if required (by assignment settings) call mod_assign_submit_for_grading
    • http://mymoodle/moodle/webservice/rest/server.php?wsfunction=mod_assign_submit_for_grading&moodlewsrestformat=json&wstoken=tokenvalue&assignmentid=1&acceptsubmissionstatement=1

I don't know if this is to best way to achieve assignment submission, I hope that this can be helpful for someone


Viewing all articles
Browse latest Browse all 2361

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>