Moodle API Workshops - C0D3D3V/Moodle-DL GitHub Wiki
To download workshops the following functions are of interest:
| Area | Name | Introduced in | Description | 
|---|---|---|---|
| mod_workshop | mod_workshop_get_workshops_by_courses | 3.4 (2017111300) | Returns a list of workshops in a provided list of courses, if no list is provided all workshops that the user can view will be returned. | 
| mod_workshop | mod_workshop_get_submissions | 3.4 (2017111300) | Retrieves all the workshop submissions or the one done by the given user (except example submissions). | 
| mod_workshop | mod_workshop_get_reviewer_assessments | 3.4 (2017111300) | Retrieves all the assessments reviewed by the given user. | 
| mod_workshop | mod_workshop_get_submission | 3.4 (2017111300) | Retrieves the given submission. | 
| mod_workshop | mod_workshop_get_grades | 3.4 (2017111300) | Returns the assessment and submission grade for the given user. | 
An example module which returns core_course_get_contents:
{
    "id": 61,
    "url": "http://archlinux-vm/moodle/mod/workshop/view.php?id=61",
    "name": "workshop",
    "instance": 1,
    "contextid": 116,
    "visible": 1,
    "uservisible": true,
    "visibleoncoursepage": 1,
    "modicon": "http://archlinux-vm/moodle/theme/image.php/boost/workshop/1633802793/icon",
    "modname": "workshop",
    "modplural": "Gegenseitige Beurteilungen",
    "indent": 0,
    "onclick": "",
    "afterlink": null,
    "customdata": "\"\"",
    "noviewlink": false,
    "completion": 1,
    "completiondata": {
        "state": 0,
        "timecompleted": 0,
        "overrideby": null,
        "valueused": false
    }
}
The module indicates where the workshop is located in the course, nothing more can be derived from it.
With the help of mod_workshop_get_workshops_by_courses all workshop-id's of all courses can be loaded. It exists since Version 3.4.
- 
courseidsis an array of the course-ids from which the workshops are to be loaded. 
mod_workshop_get_workshops_by_courses returns a list of lessons:
{
    "workshops": [
        {
            "id": 1,
            "course": 3,
            "name": "workshop",
            "intro": "Yo submit pls something<br>",
            "introformat": 1,
            "instructauthors": "<p dir=\"ltr\" style=\"text-align:left;\">SUBMITT!!!!<br /></p>",
            "instructauthorsformat": 1,
            "instructreviewers": "<p dir=\"ltr\" style=\"text-align:left;\">provide good feedback</p><p dir=\"ltr\" style=\"text-align:left;\"><br /></p>",
            "instructreviewersformat": 1,
            "timemodified": 1634485747,
            "phase": 50,
            "useexamples": false,
            "usepeerassessment": true,
            "useselfassessment": false,
            "grade": 80,
            "gradinggrade": 20,
            "strategy": "accumulative",
            "evaluation": "best",
            "gradedecimals": 0,
            "submissiontypetext": 1,
            "submissiontypefile": 1,
            "nattachments": 1,
            "submissionfiletypes": "",
            "latesubmissions": false,
            "maxbytes": 0,
            "examplesmode": 0,
            "submissionstart": 0,
            "submissionend": 0,
            "assessmentstart": 0,
            "assessmentend": 0,
            "phaseswitchassessment": false,
            "conclusion": "<p dir=\"ltr\" style=\"text-align:left;\">nice<br /></p>",
            "conclusionformat": 1,
            "overallfeedbackmode": 1,
            "overallfeedbackfiles": 0,
            "overallfeedbackfiletypes": "",
            "overallfeedbackmaxbytes": 0,
            "coursemodule": 61,
            "introfiles": [],
            "instructauthorsfiles": [],
            "instructreviewersfiles": [],
            "conclusionfiles": []
        }
    ],
    "warnings": []
}
Important attributes:
- 
courseis the id of the course the quiz belongs to. - 
idis the id of the lesson - 
coursemoduleis the module id that was returned bycore_course_get_contents - 
nameis the name of the lesson 
In the third phase of a workshop, each participant is assigned the submissions of other participants to assess them. To get this assessment we need a call to mod_workshop_get_reviewer_assessments.
Now we need mod_workshop_get_submission to get the submission of the assignment.
Now to get the assigned grade we need mod_workshop_get_grades.