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

Return cmid in all the get_XXX_by_courses

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course with a folder, a label, a page, a resource (File) and a URL.
      2. Enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for a student enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json'  --data 'courseids[0]=4&wsfunction=mod_folder_get_folders_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218'
          

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      5. Confirm that you receive the coursemodule of each folder returned.
      6. Now perform the same test for the rest of affected WebServices:
        • mod_label_get_labels_by_courses
        • mod_page_get_pages_by_courses
        • mod_resource_get_resources_by_courses
        • mod_url_get_urls_by_courses
      Show
      Create a course with a folder, a label, a page, a resource (File) and a URL. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for a student enrolled in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids[0]=4&wsfunction=mod_folder_get_folders_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Confirm that you receive the coursemodule of each folder returned. Now perform the same test for the rest of affected WebServices: mod_label_get_labels_by_courses mod_page_get_pages_by_courses mod_resource_get_resources_by_courses mod_url_get_urls_by_courses
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57890-master

      Description

      The latest get_XXX_by_courses WebServices don't return the cmid, while the rest of WebServices return that data. We should return this data too for coherence.

        Attachments

          Activity

            People

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

              Dates

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