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

Web service core_badges_get_user_badge_by_hash does not return the badge recipient

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-82742-main
    • Hide
      1. As admin, enable "Mobile services":
        Plugins ► Web Services ► Mobile
      2. Enable badges and course badges in advanced features
      3. Create a site level badge, award this badge to one student user
      4. In a course, create a course badge, award this badge to the same student user (must be enrolled in the course)
      5. Create a Token for a user other than the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Login as the student user, go to their profile, access both badges and annotate the hash in the URL.
      7. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to call it twice (one for each badge), replacing the wstoken, hash (the uniquehash badge value) and the URL of your Moodle instance

          curl 'MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_badges_get_user_badge_by_hash&wstoken=$wstoken&hash=$uniquehash' --compressed

      8. Confirm that you receive the information of the badged, including the id and full name of the recipient (the student).
      Show
      As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Enable badges and course badges in advanced features Create a site level badge, award this badge to one student user In a course, create a course badge, award this badge to the same student user (must be enrolled in the course) Create a Token for a user other than the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Login as the student user, go to their profile, access both badges and annotate the hash in the URL. Next, you can do a CURL REST call simulating a WS client with the student user. You need to call it twice (one for each badge), replacing the wstoken, hash (the uniquehash badge value) and the URL of your Moodle instance curl 'MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_badges_get_user_badge_by_hash&wstoken=$wstoken&hash=$uniquehash' --compressed Confirm that you receive the information of the badged, including the id and full name of the recipient (the student).

      The web service {{core_badges_get_user_badge_by_hash}} was introduced to retrieve badges by hash, allowing users to view badges awarded to other users in the app.

      However, this function does not return the name of the recipient, which is needed to display the same information as /badges/badge.php?hash= in the app.

       

            albert.gasset@moodle.com Albert Gasset
            albert.gasset@moodle.com Albert Gasset
            Juan Leyva Juan Leyva
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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