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

Some Web Services are not returning formatted content consistenly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.2.6, 3.3.3
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a new empty course
      2. As teacher, add a label where the content is an iframe pointing, for example, to a youtube or vimeo video (you can use the embed code of any video like this one
      3. Create also an html page resource, add in the content section the same HTML code with the iframe
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for one user enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the 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 'courseid=16&moodlewssettingfilter=true&wsfunction=core_course_get_contents&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool"

      7. Check that in the response you see both the label and page content you created. In the label description field you should see the iframe code you used
      8. Now, execute the following CURL request (ony 3.3 and master)

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids[0]=16&moodlewssettingfilter=true&wsfunction=mod_page_get_pages_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool"

      9. And check that in this case you see the page you created and that in the content field you see the iframe code
      Show
      Create a new empty course As teacher, add a label where the content is an iframe pointing, for example, to a youtube or vimeo video (you can use the embed code of any video like this one Create also an html page resource, add in the content section the same HTML code with the iframe As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one user 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 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 'courseid=16&moodlewssettingfilter=true&wsfunction=core_course_get_contents&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool" Check that in the response you see both the label and page content you created. In the label description field you should see the iframe code you used Now, execute the following CURL request (ony 3.3 and master) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids [0] =16&moodlewssettingfilter=true&wsfunction=mod_page_get_pages_by_courses&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool" And check that in this case you see the page you created and that in the content field you see the iframe code
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-60377-master

      Description

      It seems that some Web Services are not formatting text using the same options than the web version.

      This is making the app to not display iframes in labels or in other web services.

      For example:
      core_course_get_contents: Failing for label
      mod_page_get_pages_by_courses: Failing
      mod_label_get_labels_by_courses: Failing

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17