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

Add a new "ids" criteria in core_course_get_categories

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.2
    • Fix Version/s: 3.2
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a Token for one user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create a couple of course categories in Moodle, including subcategories
      4. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, the category ids (use only the parent category ids) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'criteria[0][key]=ids&criteria[0][value]=1,2,3&addsubcategories=0&wsfunction=core_course_get_categories&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      5. Check that you receive only the categories indicated by id
      6. Now, change the addsubcategories parameter to 1 and check that now apart the categories indicated in criteria[0][value] you receive also the subcategories
      Show
      As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one user: Click on Site administration ► Plugins ► Web services ► Manage tokens Create a couple of course categories in Moodle, including subcategories Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, the category ids (use only the parent category ids) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'criteria [0] [key] =ids&criteria [0] [value] =1,2,3&addsubcategories=0&wsfunction=core_course_get_categories&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Check that you receive only the categories indicated by id Now, change the addsubcategories parameter to 1 and check that now apart the categories indicated in criteria [0] [value] you receive also the subcategories
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-54801-master

      Description

      We should be able to retrieve a list of categories searching by id, so a new ids criteria would be reasonable (to avoid multiple calls per category)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16