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

Add a new "ids" criteria in core_course_get_categories

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.2
    • 3.1, 3.2
    • Web Services
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_32_STABLE
    • MDL-54801-master
    • 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

      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)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Ryan Wyllie Ryan Wyllie
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.