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

forum_get_discussions web service should allow pagination

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.4, 2.6.1
    • Fix Version/s: 2.7
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Testing:

      Use this client: https://gist.github.com/jleyva/9348162
      The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

      You need a token related to a service, for get a token you need to create a new service, add a shortname to that service (in the database), and add the mod_forum_get_forum_discussions function to that service

      To get a token:
      yourmoodle.com/login/token.php?service=ServiceShortname&username=XX&password=YYY

      1 Create a new course
      2 Create a new forum with a couple of discussion and posts
      3 Edit the client.php for adding your custom token and Moodle URL, also the forum instance id (not the cmid)
      Remember to enrol the user you used to get a token to the course
      4 Open the script in a browser
      5 Check that you receive all the discussions in the forum
      6 Change the limitfrom and limitnumb, check that you receive only the requested discussions
      7 Edit the client PHP file, and delete the limitfrom and limitnum parameters, it should work as expected

      Show
      Testing: Use this client: https://gist.github.com/jleyva/9348162 The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php You need a token related to a service, for get a token you need to create a new service, add a shortname to that service (in the database), and add the mod_forum_get_forum_discussions function to that service To get a token: yourmoodle.com/login/token.php?service=ServiceShortname&username=XX&password=YYY 1 Create a new course 2 Create a new forum with a couple of discussion and posts 3 Edit the client.php for adding your custom token and Moodle URL, also the forum instance id (not the cmid) Remember to enrol the user you used to get a token to the course 4 Open the script in a browser 5 Check that you receive all the discussions in the forum 6 Change the limitfrom and limitnumb, check that you receive only the requested discussions 7 Edit the client PHP file, and delete the limitfrom and limitnum parameters, it should work as expected
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      This is something usual in WebServices, we forgot to add pagination... in this case is critical, just imagine calling this webservice for the bigger forum in moodle.org!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Martin Dougiamas
              Integrator:
              Sam Hemelryk
              Tester:
              Rajesh Taneja
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/May/14