Querying for Badge Groups
Once you have the earner's Backpack user ID, you can query for their public badge groups.
var Openbadges = require('machinepack-openbadges');
// Querying for Badge Groups
Openbadges.getCollections({
uid: 125363,
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// Could not find a collections by the Backpack user ID
collesionsNotFound: function (result) {
},
// OK.
success: function (result) {
},
});
Backpack user ID
125363
An unexpected error occurred.
Could not find a collections by the Backpack user ID
{
status: 404,
headers: '{"Accepts":"application/json"}',
body: '{"httpStatus":404,"status":"missing"}'
}
OK.
{
status: 200,
headers: '{"Accepts":"application/json"}',
body: '{"userId":125363,"groups":[{"groupId":45690,"name":"Javascript","badges":11}...]}'
}