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

New Web Service core_blog_view_entries

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.1
    • Fix Version/s: 3.6
    • Component/s: Blog
    • Testing Instructions:
      Hide
      1. Login as admin
      2. Enable blogs in Site administration > Advanced features
      3. Go to Site administration > Appearance > Blog and enable “Enable blog associations” and set Blog visibility to “All site users can see all blog entries”
      4. Go to the Admin profile (click on his name at the top of the right) > Profile > Blog entries and then "Add a new entry"
      5. Add a new Blog entry. Ensure that “Publish to” is set to “Anyone on this site”
      6. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      7. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_blog_view_entries&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' | python -m "json.tool"

      9. Confirm that:
        • You receive a JSON structure with the field status set to true
        • If as admin you go to Site administration > Report > Logs you see a "Blog entries viewed" event name with Origin set to ws.
      10. Now, append the following to the curl request: &filters[0][name]=userid&filters[0][value]=ADMIN_USER_ID (replacing ADMIN_USER_ID) with the id of the admin user
      11. In the console execute the curl request and check that:
        • You receive a JSON structure with the field status set to true
        • If as admin you go to Site administration > Report > Logs you will see a new "Blog entries viewed" event (one or more lines above the previous event with the same name) name with Origin set to ws. If you click to "Blog entries viewed" the link should redirect to YOUR_SITE_URL/blog/index.php?userid=ADMIN_USER_ID

      Note: This new WS function shares a lot of code with the get_entries WS (MDL-60425) that has a good human and unit testing coverage

      Show
      Login as admin Enable blogs in Site administration > Advanced features Go to Site administration > Appearance > Blog and enable “Enable blog associations” and set Blog visibility to “All site users can see all blog entries” Go to the Admin profile (click on his name at the top of the right) > Profile > Blog entries and then "Add a new entry" Add a new Blog entry. Ensure that “Publish to” is set to “Anyone on this site” As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_blog_view_entries&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' | python -m "json.tool" Confirm that: You receive a JSON structure with the field status set to true If as admin you go to Site administration > Report > Logs you see a "Blog entries viewed" event name with Origin set to ws. Now, append the following to the curl request: &filters [0] [name] =userid&filters [0] [value] =ADMIN_USER_ID (replacing ADMIN_USER_ID) with the id of the admin user In the console execute the curl request and check that: You receive a JSON structure with the field status set to true If as admin you go to Site administration > Report > Logs you will see a new "Blog entries viewed" event (one or more lines above the previous event with the same name) name with Origin set to ws. If you click to "Blog entries viewed" the link should redirect to YOUR_SITE_URL/blog/index.php?userid=ADMIN_USER_ID Note: This new WS function shares a lot of code with the get_entries WS ( MDL-60425 ) that has a good human and unit testing coverage
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61245-master

      Description

      We need a new WS for triggering the blog_entries_viewed event

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m