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

External function core_enrol_get_users_courses should return additional course information

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.5
    • Fix Version/s: 2.9
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Create two courses
      2. Assign different (Course Format, Course summary, Force language, Enable completion tracking,
        Show gradebook to students) for each course.
      3. Create one student and one teacher
      4. Enroll the student and the teacher in both courses
      5. Enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for the teacher :
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client call as teacher,
        and ask courses information about the student’s enrolled courses
        • You need to replace the wstoken and userid and the URL of your moodle instance:

          curl 'http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'userid=4&wsfunction=core_enrol_get_users_courses&wstoken=b90046a601081cd5f8ac2012d708b74d' --compressed
          

      1. Now, you should verify that all the new fields appears as expected: (summary, summaryformat, format, showgrades, lang, enablecompletion)
      Show
      Create two courses Assign different (Course Format, Course summary, Force language, Enable completion tracking, Show gradebook to students) for each course. Create one student and one teacher Enroll the student and the teacher in both courses Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the teacher : Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client call as teacher, and ask courses information about the student’s enrolled courses You need to replace the wstoken and userid and the URL of your moodle instance: curl 'http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'userid=4&wsfunction=core_enrol_get_users_courses&wstoken=b90046a601081cd5f8ac2012d708b74d' --compressed Now, you should verify that all the new fields appears as expected: (summary, summaryformat, format, showgrades, lang, enablecompletion)
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49606-master

      Description

      This information return information about the courses where the user is enrolled, currently it only return basic information (like id, fullname and shortname) but it will be interesting return additional information about the basic public settings of the course.
      This will allow WS client implementations to avoid have to do additional requests to course_get_courses external function for retrieving extra information.

      Additional information that should be returned:
      summary
      summaryformat
      format
      showgrades
      lang
      enablecompletion

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/15