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

New Web Service mod_data_get_entries

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-49409-master
    • Hide
      1. Create a course with a database using the image gallery preset
      2. Enrol a couple of users as teacher and student in that course
      3. As the student or teacher add a couple of entries to the database
      4. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token in the mobile app service for the student 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 student.
        • You need to replace the wstoken, databaseid (database instance id) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'databaseid=8&wsfunction=mod_data_get_entries&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&returncontents=1' | python -m "json.tool"

      7. Now check that you receive the correct number of entries
      8. You should also check that the contents (in the field contents for each entry) for each entry match the ones you created.
      9. You should also check that in the listviewcontents field you see HTML output with the entries rendered (as they are rendered in the Moodle web version) except for the template header and footer.
      10. If you execute the curl request again but removing the (&returncontents=1) you will receive just the list of entries (and not the contents)
      11. If you configure the database to require approval and create using other students accounts new entries you should not be able to see them (via the curl request) until they are approved
      12. In general the output of the curl request should match what you see in the Moodle web version
      Show
      Create a course with a database using the image gallery preset Enrol a couple of users as teacher and student in that course As the student or teacher add a couple of entries to the database Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student 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 student. You need to replace the wstoken, databaseid (database instance id) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'databaseid=8&wsfunction=mod_data_get_entries&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&returncontents=1' | python -m "json.tool" Now check that you receive the correct number of entries You should also check that the contents (in the field contents for each entry) for each entry match the ones you created. You should also check that in the listviewcontents field you see HTML output with the entries rendered (as they are rendered in the Moodle web version) except for the template header and footer. If you execute the curl request again but removing the (&returncontents=1) you will receive just the list of entries (and not the contents) If you configure the database to require approval and create using other students accounts new entries you should not be able to see them (via the curl request) until they are approved In general the output of the curl request should match what you see in the Moodle web version

      Return a complete list of the database records, including (optionally) it contents and files the current user can see with it currents permissions (supporting groups, etc...)

      Also for every record the result of data_user_can_manage_entry must be returned (so the ability of editing existing records can be calculated).

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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