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

New Web Service core_course_search_courses

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9
    • Fix Version/s: 3.0
    • Component/s: Course, Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Note: Version numbers are bumped because a new web service is added into the Mobile app service

      1. Create a new course, enroll a couple of users as editing teachers
      2. Add a couple of attachments in the course summary files
      3. Allow some enrolment methods
      4. In the global coursecontact setting, add the teacher, and editing teacher roles
      5. Enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the he student user .
        • You need to replace the wstoken, and criteriavalue (to match your course name) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'criterianame=search&criteriavalue=chat&wsfunction=core_course_search_courses&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e'

          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

      8. Confirm that
        • You receive a list of courses that match your search criteria, the course information is returned correctly including the category information, contact users (teachers) and course summary files
      9. Search again using this criteria: criterianame=blocklist&criteriavalue=31 (search courses with the block search forums, note the block id can be different)
      10. Search again using this criteria: criterianame=modulelist&criteriavalue=forum (search courses with forums)
      Show
      Note: Version numbers are bumped because a new web service is added into the Mobile app service Create a new course, enroll a couple of users as editing teachers Add a couple of attachments in the course summary files Allow some enrolment methods In the global coursecontact setting, add the teacher, and editing teacher roles Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the he student user . You need to replace the wstoken, and criteriavalue (to match your course name) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'criterianame=search&criteriavalue=chat&wsfunction=core_course_search_courses&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' 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 You receive a list of courses that match your search criteria, the course information is returned correctly including the category information, contact users (teachers) and course summary files Search again using this criteria: criterianame=blocklist&criteriavalue=31 (search courses with the block search forums, note the block id can be different) Search again using this criteria: criterianame=modulelist&criteriavalue=forum (search courses with forums)
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49942-master

      Description

      Search courses
      search by ('name', 'blocklist', 'modulelist', 'tagid')

      params:
      criterianame
      criteriavalue
      page
      perpage

      Returns:
      totalcourses
      courses(name, shortname, description+attachment, categoryname,categoryid, courseid, teachers, guestaccessenabled )
      warnings

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            ccito Costantino Cito
            Peer reviewer:
            Simey Lameze
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            John Okely
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              16/Nov/15