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

mod_resource_get_resources_by_courses

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9, 3.3
    • 3.3
    • Resource, Web Services
    • MOODLE_29_STABLE, MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-50547-master
    • Hide

      emphasized text

      Show
      emphasized text
    • Hide
      1. Create a couple of files resources (including images in the description). Hide one of the files.
      2. Enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for one teacher and one student enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and 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_resource_get_resources_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
        • As student you only see the visible file activity and all the settings fields
        • As a teacher you see all the file resources.
        • In both cases you retrieve successfully the images inclued in the resource summary (introfiles field) and the file itself (contentfiles field).
      Show
      Create a couple of files resources (including images in the description). Hide one of the files. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one teacher and one student enrolled in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and 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_resource_get_resources_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 As student you only see the visible file activity and all the settings fields As a teacher you see all the file resources. In both cases you retrieve successfully the images inclued in the resource summary (introfiles field) and the file itself (contentfiles field).
    • Small

    Description

      Retrieve a list of resources from several courses

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              ccito Costantino Cito
              Ryan Wyllie Ryan Wyllie
              Andrew Lyons Andrew Lyons
              cameron1729 cameron1729
              Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/May/17