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

External function forum_get_discussion_posts should return attachments and user picture URL

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.8
    • 2.7.2
    • Forum, Web Services
    • MOODLE_27_STABLE
    • MOODLE_28_STABLE
    • MDL-47084-master
    • Hide
      1. Inside a course create a forum (general) with a discussion, change the Attachment settings in the forum instance for allowing multiple attachments in a post
      2. Inside the discussion create a couple of posts including attachments and also images embedded in the post body
      3. Enable "Mobile services": Plugins ► Web Services ► External services
      4. Create a Token:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Click add, select user and service (Mobile Service)
      6. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the discussionid value (8) to your postdiscussion id.
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/moodlebugs/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' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) 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 'discussionid=8&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed
          

      7. Confirm that:
        • The result of that curl call list all your posts in the discussion with all the attachments and also the image URLs rewritten to use webservice/pluginfile and the user profile picture URL:
          You can use this online tool http://jsonlint.com/ to format the JSON returned by the curl call
      Show
      Inside a course create a forum (general) with a discussion, change the Attachment settings in the forum instance for allowing multiple attachments in a post Inside the discussion create a couple of posts including attachments and also images embedded in the post body Enable "Mobile services": Plugins ► Web Services ► External services Create a Token: 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 discussionid value (8) to your postdiscussion id. You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/moodlebugs/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' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) 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 'discussionid=8&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed Confirm that: The result of that curl call list all your posts in the discussion with all the attachments and also the image URLs rewritten to use webservice/pluginfile and the user profile picture URL: You can use this online tool http://jsonlint.com/ to format the JSON returned by the curl call

      The function doesn't return a list of files to be downloaded, we need that in order to implement forums support in the Mobile app, additionally image plugin file urls are not rewritten and the user profile image URL is missing.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Sam Hemelryk Sam Hemelryk
            Dan Poltawski Dan Poltawski
            Dave Cooper Dave Cooper
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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