XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.3
    • 2.9
    • Comments
    • MOODLE_28_STABLE
    • MOODLE_29_STABLE
    • MDL-49203-master
    • Hide
      1. Create a new course with just one section, create a new database module with comments enabled.
      2. Create a couple of database records (database entries)
      3. As a student and admin, comment only in one of the database records
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the user (student) your are going to test with:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Click add, select user and service (Mobile Service)
      7. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the wstoken and the URL of your moodle instance. And the following parameters:
          instanceid with the course module id and itemid with the database entry record id you commented in, the id from the data_records table

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'contextlevel=module&instanceid=84&component=mod_data&itemid=1&area=database_entry&page=0&wsfunction=core_comment_get_comments&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' --compressed
          

      8. Confirm that:
        • You receive a list including all the comments in the database record entry
        • If you try to retrieve comments from a different entry (empty) you will receive just empty arrays
      9. You can use jsonlint.com for formatting the output
      Show
      Create a new course with just one section, create a new database module with comments enabled. Create a couple of database records (database entries) As a student and admin, comment only in one of the database records Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the user (student) your are going to test with: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the wstoken and the URL of your moodle instance. And the following parameters: instanceid with the course module id and itemid with the database entry record id you commented in, the id from the data_records table curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'contextlevel=module&instanceid=84&component=mod_data&itemid=1&area=database_entry&page=0&wsfunction=core_comment_get_comments&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' --compressed Confirm that: You receive a list including all the comments in the database record entry If you try to retrieve comments from a different entry (empty) you will receive just empty arrays You can use jsonlint.com for formatting the output

    Description

      Return all the comments for an specific component, context.

      Parameters:
      contextlevel => context_course, context_user, context_module, etc..
      instanceid => Instance id (course id, user id, etc...)
      component => Component name, mod_forum, core_blog, etc...
      itemid => int the id of the associated item (forum post, glossary item etc)
      area => string comment area (default "")
      page => page number (default 0)

      Attachments

        Activity

          People

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Ankit Agarwal Ankit Agarwal
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/May/15