Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-48719

New WS function: core_message_get_blocked_users

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.2
    • 2.9
    • Web Services
    • MOODLE_28_STABLE
    • MOODLE_29_STABLE
    • MDL-48719-master
    • Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service.

      1. Enable messaging in the site
      2. Create a couple of users accounts, user1 and user2
      3. Log in as user2, send a message from user2 to user1
      4. Log in as user1, go to view your messages. Add user2 as contact, and once added as contact use the icon for "block the user". user2 should be displayed in the list of blocked users.
      5. Enable "Mobile services": Plugins ► Web Services ► External services
      6. Create a Token for the Mobile app service (for user1):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the userid value with the user1->id .
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache'  -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 'userid=4&wsfunction=core_message_get_blocked_users&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed
          

      8. Confirm that:
        • The command returns a list of blocked users (in this case, only user2), including id, fullname and the profile image URL
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. Enable messaging in the site Create a couple of users accounts, user1 and user2 Log in as user2, send a message from user2 to user1 Log in as user1, go to view your messages. Add user2 as contact, and once added as contact use the icon for "block the user". user2 should be displayed in the list of blocked users. Enable "Mobile services": Plugins ► Web Services ► External services Create a Token for the Mobile app service (for user1): Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client: You need to replace the userid value with the user1->id . You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -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 'userid=4&wsfunction=core_message_get_blocked_users&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed Confirm that: The command returns a list of blocked users (in this case, only user2), including id, fullname and the profile image URL

    Description

      This function will return a list of blocked users for the user specified as a parameter.

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Simey Lameze Simey Lameze
              Andrew Lyons Andrew Lyons
              Frédéric Massart Frédéric Massart
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/May/15