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

Update Badges Web Services to return new fields and data added by the 2.0 spec

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.2
    • Fix Version/s: 3.6
    • Component/s: Badges
    • Testing Instructions:
      Hide
      1. Login as admin.
      2. Create a new user: U1.
      3. Create 2 new badges. Add Endorsement, Related badges and Competencies to one of them, but not to the other one.
      4. Enable both badges.
      5. Award both badges to U1.
      6. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      7. Create a Token in the mobile app service for the user U1 and for the admin.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours.

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

      9. After executing the WS check that:
        • You receive both badges
        • You can see the endorsement, competencies and related badges for the badge that have it. Check that the other one doesn't have an endorsement, and the competencies and relatedbadges lists are empty.
        • You only see the id and name of related badges, and you can only see the id, targetname and targeturl of the competencies.
      10. Now open the console an execute this new curl request, replacing wstoken with the token for the admin user, the site url with yours and the userid with the U1 id.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_badges_get_user_badges&wstoken=3af67232a7596ceb658df4db329e5ad6&userid=4' --compressed | python -m "json.tool"

      11. After executing the WS check that:
        • You receive both badges
        • You can see the endorsement, competencies and related badges for the badge that have it. Check that the other one doesn't have an endorsement, and the competencies and relatedbadges lists are empty.
        • You can see all the fields of competencies and relatedbadges.
      Show
      Login as admin. Create a new user: U1. Create 2 new badges. Add Endorsement, Related badges and Competencies to one of them, but not to the other one. Enable both badges. Award both badges to U1. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the user U1 and for the admin. Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_badges_get_user_badges&wstoken=3af67232a7596ceb658df4db329e5ad6' --compressed | python -m "json.tool" After executing the WS check that: You receive both badges You can see the endorsement, competencies and related badges for the badge that have it. Check that the other one doesn't have an endorsement, and the competencies and relatedbadges lists are empty. You only see the id and name of related badges, and you can only see the id, targetname and targeturl of the competencies. Now open the console an execute this new curl request, replacing wstoken with the token for the admin user , the site url with yours and the userid with the U1 id. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_badges_get_user_badges&wstoken=3af67232a7596ceb658df4db329e5ad6&userid=4' --compressed | python -m "json.tool" After executing the WS check that: You receive both badges You can see the endorsement, competencies and related badges for the badge that have it. Check that the other one doesn't have an endorsement, and the competencies and relatedbadges lists are empty. You can see all the fields of competencies and relatedbadges.
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63729-master

      Description

      MDL-58454 added new fields and tables to support the 2.0 specification, we need to update the existing Web Services to return everything new

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dpalou Daniel Palou
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Juan Leyva
                Integrator:
                David Monllaó
                Tester:
                Jennifer Bauzon
                Participants:
                Component watchers:
                Yuliya Bozhko, Amaia Anabitarte, David Mudrák (@mudrd8mz), Sara Arjona (@sarjona)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

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

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m