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

Add user idnumber and gradeitem idnumber to gradereport_user_get_grade_items webservice

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_310_STABLE
    • MDL-69486-grade-idnumber
    • 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. View the participants page
      5. Edit one of the users
      6. Set an idnumber
      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 'gradeitems' entry contains the field 'useridnumber' with value set above for idnumber
      2. Edit the first Assignment in the course
      3. Set the idnumber to a value of your choosing
        #) Rerun the webservice curl, and verify the webservice response contains a 'gradeitems' field, which contains an 'idnumber'
        1. * Verify that for the gradeitem with 'itemname' =  'Assignment 1' the 'idnumber' matches the one you just set*
      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 View the participants page Edit one of the users Set an idnumber 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 'gradeitems' entry contains the field 'useridnumber' with value set above for idnumber Edit the first Assignment in the course Set the idnumber to a value of your choosing #) Rerun the webservice curl, and verify the webservice response contains a 'gradeitems' field, which contains an 'idnumber' * Verify that for the gradeitem with 'itemname' =  'Assignment 1' the 'idnumber' matches the one you just set*

      Currently there is no way to extract this information from moodle while relating all the information together. This means that external SMS solutions that may rely on user ID number matching to a student (or staff) ID number cannot always properly relate items from the API together. Adding these fields is just a little extra information to assist with integrations of this nature

            peterburnett Peter Burnett
            peterburnett Peter Burnett
            Brendan Heywood Brendan Heywood
            Andrew Lyons Andrew Lyons
            Andrew Lyons Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 20 minutes
                20m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.