Badges
User Profile Badges
A user profile badge is a badge that is linked to a user profile. A user profile can have multiple badges that can be earned or awarded. Once a badge is earned or awarded it stays linked to the user profile regardless of any changes done to the badge.
How to setup a badge?
Refer Utilizing Badge documentation.
Retrieve badges earned or awarded to a user
All the badges that have been earned or awarded to a user profile can be retrieved using the code samples below
API Definition: getProfileBadges
import { getProfileBadges } from '@livelike/javascript'
getProfileBadges({
profileId: "xxxxxx"
}).then(paginatedResponse => console.log(paginatedResponse.results))
Retrieving user's progress towards earning a badge
A user's progress towards a badge can be retrieved using the code examples below. Since a single badge could be setup to be earned in different ways, multiple badge progressions are linked to a single Badge.
API Definition: getBadgeProgress
import { getBadgeProgress } from '@livelike/javascript'
getBadgeProgress({
profileId: "<profile id>",
badgeIds: ["xxxx", "xxxx"]
}).then(res => console.log(res))
Retrieving all badges linked to an application
As an integrator you have the ability to retrieve all of the badges linked to an application. The results of this call can be used at a later time to query badge progress by passing badge ID's of interest.
API Definition: getApplicationBadges
import { getApplicationBadges } from '@livelike/javascript'
getApplicationBadges()
.then(padinatedResponse => console.log(padinatedResponse.results))
Retrieving all profiles for a given badge
As an integrator you have the ability to retrieve all the profiles who have earned a given badge.
API Definition: getBadgeProfiles
import { getBadgeProfiles } from '@livelike/javascript'
getBadgeProfiles({
badgeId: "<badge Id>"
}).then(res => console.log(res))
Updated 10 months ago