May 26, 2024
Efficient Badge Retrieval: Extracting Learner’s Assigned and Achieved Badges via ALM API
Comments
(0)
May 26, 2024
Efficient Badge Retrieval: Extracting Learner’s Assigned and Achieved Badges via ALM API
https://www.linkedin.com/in/anupam-gogoi-97a14888/
Wizard
Followers: 22 people
(0)

GET /users/{userId}/userBadges

  • Retrieves list of user badges

Implementation Notes

Get a list of user badges for a user in your organization

Response Class (Status 200)

Operation successful
Example response –

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "assertionUrl": "string",
        "dateAchieved": "string",
        "expiryDate": "string",
        "modelType": "string"
      },
      "relationships": {
        "badge": {
          "data": {
            "type": "string",
            "id": "string"
          }
        },
        "learner": {
          "data": {
            "type": "string",
            "id": "string"
          }
        },
        "model": {
          "data": {
            "type": "string",
            "id": "string"
          }
        }
      }
    }
  ]
}
    application/vnd.api+json;charset=UTF-8

Parameters

Parameter Value Description Parameter Type Data Type
refer –

https://elearning.adobe.com/?p=171607

Mention any additional model to be tagged along with this model query string
Mention the maximum number of records to be displayed per page. Max allowed is 10 query integer
Mention the last cursor till the records are fetched query string
                  dateAchieved  (default)            -dateAchieved Choose the type of sorting to be applied to the results. Sorting based on recommendation score will only be applicable for PRL enabled LOs query string
The id of the user for whose account, the data is being requested path string
Mention ids of userBadges for which data is being requested.Max allowed number of ids that can be included is 10 query Array[]

Response Messages

HTTP Status Code Reason Response Model Headers
400 A generic http bad request error
{
  "meta": {
    "error": "string",
    "detail": "string"
  }
}
401 A generic http unauthorized access error. Access is denied due to invalid credentials
{
  "meta": {
    "error": "string",
    "detail": "string"
  }
}

Curl 

curl -X GET --header 'Accept: application/vnd.api+json' --header 'Authorization: oauth 2fd8739caecd258732w232b601ad4fe238e203' 'https://learningmanager.adobe.com/primeapi/v2/users/20276735/userBadges?page[limit]=10&sort=dateAchieved'

Request URL 

https://learningmanager.adobe.com/primeapi/v2/users/20276735/userBadges?page[limit]=10&sort=dateAchieved

Response Body 

{
  "links": {
    "self": "https://learningmanager.adobe.com/primeapi/v2/users/20276735/userBadges?page[limit]=10&sort=dateAchieved",
    "next": "https://learningmanager.adobe.com/primeapi/v2/users/20276735/userBadges?page[limit]=10&sort=dateAchieved&page[cursor]=10"
  },
  "data": [
    {
      "id": "20276735_1065989_LP_91333",
      "type": "userBadge",
      "attributes": {
        "assertionUrl": "https://cpcontents.adobe.com/public/accountassets/108079/badges/assertions/93f9b7fb714b4b71bad90238a5d1c89e_1683459008456.json",
        "dateAchieved": "2023-05-07T11:30:00.000Z",
        "modelType": "learningObject"
      },
      "relationships": {
        "badge": {
          "data": {
            "id": "1065989",
            "type": "badge"
          }
        },
        "learner": {
          "data": {
            "id": "20276735",
            "type": "user"
          }
        },
        "model": {
          "data": {
            "id": "learningProgram:91333",
            "type": "learningObject"
          }
        }
      }
    },
    {
      "id": "20276735_1065989_COMPETENCY_352794_2",
      "type": "userBadge",
      "attributes": {
        "assertionUrl": "https://cpcontents.adobe.com/public/accountassets/108079/badges/assertions/be94b8237a40481589a238c8e0973b95_1683460438440.json",
        "dateAchieved": "2023-05-07T11:53:55.000Z",
        "modelType": "skillLevel"
      },
      "relationships": {
        "badge": {
          "data": {
            "id": "1065989",
            "type": "badge"
          }
        },
        "learner": {
          "data": {
            "id": "20276735",
            "type": "user"
          }
        },
        "model": {
          "data": {
            "id": "352794_2",
            "type": "skillLevel"
          }
        }
      }
    },
    {
      "id": "20276735_1065989_COURSE_6914817_7448494",
      "type": "userBadge",
      "attributes": {
        "assertionUrl": "https://cpcontents.adobe.com/public/accountassets/108079/badges/assertions/14e52035034e4dd6a3204f87a42c03ef_1687810745323.json",
        "dateAchieved": "2023-06-26T20:19:02.000Z",
        "modelType": "learningObject"
      },
      "relationships": {
        "badge": {
          "data": {
            "id": "1065989",
            "type": "badge"
          }
        },
        "learner": {
          "data": {
            "id": "20276735",
            "type": "user"
          }
        },
        "model": {
          "data": {
            "id": "course:6914817",
            "type": "learningObject"
          }
        }
      }
    }
  ]
}

Response Code

200

Response Headers

{
  "access-control-allow-credentials": "true",
  "access-control-allow-headers": "X-acap-all-roles, X-acap-account,X-acap-user,X-acap-caller-role,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, x-experience-api-version, Authorization, X-CSRF-TOKEN, X-HTTP-Method-Override, X-acap-ug-manager-scope, X-acap-extension-token",
  "access-control-allow-methods": "GET, POST, OPTIONS, PUT, HEAD, DELETE, PATCH",
  "access-control-expose-headers": "Requested-Accept-Language, x-rate-limit, x-burst, x-excess-requests-per-second, Retry-After",
  "age": "-1",
  "cache-control": "no-cache, no-store, max-age=0, must-revalidate",
  "content-encoding": "gzip",
  "content-type": "application/vnd.api+json;charset=UTF-8",
  "date": "Sun, 26 May 2024 15:00:16 GMT",
  "expires": "-1",
  "pragma": "no-cache",
  "requested-accept-language": "en-US,en;q=0.9",
  "server": "openresty",
  "server-timing": "server_resp;dur=25",
  "strict-transport-security": "max-age=31536000; includeSubDomains",
  "x-content-type-options": "nosniff",
  "x-frame-options": "SAMEORIGIN",
  "x-request-id": "gwdc3c8e0fe0cddb4c2ee26a86c70230ea07",
  "x-xss-protection": "1"
}

————————————————————————————————————————————-

-tags-
#How to extract the list of badges assigned and achieved by the learner in ALM API #list of user badges in ALM #Json #API to retrieve all badges of a learner user

0 Comments
Add Comment