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

Add courseId and forumId info to mod_forum_get_discussion_posts web service

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE
    • MDL-69577-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for one user enrolled in the course (and not the admin):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create a new course
      4. Create a new forum with a discussion and some posts.
      5. Remember to enrol the user to the forum course.
      6. Annotate the discussion Id from the URL (mod/forum/discuss.php?d=DISCUSSIONID)
      7. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, and the URL of your moodle instance and replacing the X (value of the discussionid) with the DISCUSSIONID you copied

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_discussion_posts&wstoken=3cfbcfd3199db5c8846d771b4cc8f197' | python -m "json.tool"

      1. Confirm that after executing the request:
        • You got courseid and forumid fields and they are correct.
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one user enrolled in the course (and not the admin): Click on Site administration ► Plugins ► Web services ► Manage tokens Create a new course Create a new forum with a discussion and some posts. Remember to enrol the user to the forum course. Annotate the discussion Id from the URL (mod/forum/discuss.php?d=DISCUSSIONID) Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, and the URL of your moodle instance and replacing the X (value of the discussionid) with the DISCUSSIONID you copied curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_discussion_posts&wstoken=3cfbcfd3199db5c8846d771b4cc8f197' | python -m "json.tool" Confirm that after executing the request: You got courseid and forumid fields and they are correct.

      Direct navigation to a discussion in the app will get all posts of the discussion but will not have any info about forum or course that the discussion needs to show options like pin or attach files on reply.

      It will be great that near the posts return variable we could add forumid and courseid or even cmid.

            pferre22 Pau Ferrer
            pferre22 Pau Ferrer
            Amaia Anabitarte Amaia Anabitarte
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour
                1d 1h

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