Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-71007

Extend gradereport_user_get_grade_items web service to show course idnumber

    XMLWordPrintable

Details

    • MOODLE_311_STABLE
    • MDL-71007-courseidnumer-grade-ws-MOODLE_311_STABLE
    • MDL-71007-courseidnumer-grade-ws
    • Hide

      Prerequisites

      1. Enable webservices, and set the protocol to rest /admin/category.php?category=webservicesettings
      2. Create a new service 'gradetest' which accesses only gradereport_user_get_grade_items with no permission restrictions
      3. Create a token for the admin account, for the 'gradetest' service

      Create a test course for testing

      1. Visit /admin/settings.php?section=debugging and set debugging level to DEVELOPER
      2. Visit /admin/tool/generator/maketestcourse.php and create an XS course for use in testing.
      3. Note the courseid
      4. Set a course idnumber and note this
      5. View the participants page
      6. Select a test user
      7. Note the user id

      Test the webservice from CLI

      1. Open a terminal (with curl installed) and execute:

        curl "{ADDRESS_HERE}/webservice/rest/server.php?wstoken={TOKEN_HERE}&wsfunction=gradereport_user_get_grade_items&moodlewsrestformat=json&courseid={COURSEID}&userid={USERID}" | json_pp -
        

        1. Verify that the 'courseidnumber' entry contains the course idnumber
      Show
      Prerequisites Enable webservices, and set the protocol to rest /admin/category.php?category=webservicesettings Create a new service 'gradetest' which accesses only gradereport_user_get_grade_items with no permission restrictions Create a token for the admin account, for the 'gradetest' service Create a test course for testing Visit /admin/settings.php?section=debugging and set debugging level to DEVELOPER Visit /admin/tool/generator/maketestcourse.php and create an XS course for use in testing. Note the courseid Set a course idnumber and note this View the participants page Select a test user Note the user id Test the webservice from CLI Open a terminal (with curl installed) and execute: curl "{ADDRESS_HERE}/webservice/rest/server.php?wstoken={TOKEN_HERE}&wsfunction=gradereport_user_get_grade_items&moodlewsrestformat=json&courseid={COURSEID}&userid={USERID}" | json_pp - Verify that the 'courseidnumber' entry contains the course idnumber

    Description

      Just add the courseidnumber field to the output

      Attachments

        Activity

          People

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Peter Burnett Peter Burnett
            Adrian Greeve Adrian Greeve
            Sujith Haridasan Sujith Haridasan
            Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              17/May/21

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h