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

New Web Service mod_data_get_entry

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57918-master
    • Hide
      1. Create a course with a database using the image gallery preset . Configure the database so new entries requires approval.
      2. Enrol a couple of users as teacher and student in that course
      3. As the student add a couple of entries to the database.
      4. As teacher approve just one of the entries.
      5. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for the teacher and the student in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the student token.
        • You need to replace the wstoken, entryid (with the approved entry idd) and the URL of your moodle instance

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

      8. Now check that you receive correctly the entry
      9. You should also check that the contents (in the field contents of the entry) match the ones you created.
      10. You should also check that in the entryviewcontents 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.
      11. If you execute the curl request again but removing the (&returncontents=1) you will receive just the entry (and not the contents)
      12. If you execute the curl request but requesting the entryid not approved, you will get an exception
      13. If you execute the previous curl request as teacher you will be able to retrieve the not approved entry.
      Show
      Create a course with a database using the image gallery preset . Configure the database so new entries requires approval. Enrol a couple of users as teacher and student in that course As the student add a couple of entries to the database. As teacher approve just one of the entries. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the teacher and 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 token. You need to replace the wstoken, entryid (with the approved entry idd) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'entryid=14&wsfunction=mod_data_get_entry&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&returncontents=1' | python -m "json.tool" Now check that you receive correctly the entry You should also check that the contents (in the field contents of the entry) match the ones you created. You should also check that in the entryviewcontents 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 entry (and not the contents) If you execute the curl request but requesting the entryid not approved, you will get an exception If you execute the previous curl request as teacher you will be able to retrieve the not approved entry.

      Get a simple entry (record) of the given database (checking groups permissions, etc..)

      It should return both the content for each field, files and also the rendered content.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Ankit Agarwal Ankit Agarwal
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jake Dallimore Jake Dallimore
            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.