Openbadges.getBadges()

Querying for Badges in a Group

Once you have the earner's Backpack user ID and the IDs for any groups you are interested in, you can make a request that will provide you with the earner's awarded badges within each specified group.

Usage

Hover over inputs/exits for more info.

var Openbadges = require('machinepack-openbadges');


// Querying for Badges in a Group

Openbadges.getBadges({

uid: 125363,

gid: 67890,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Could not find a badges.

badgesNotFound: function (result) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

uid required

Backpack user ID

125363
gid required

group ID

67890

Exits

error

An unexpected error occurred.

badgesNotFound

Could not find a badges.

{ status: 404,
  headers: '{"Accepts":"application/json"}',
  body: '{"httpStatus":404,"status":"missing"}' }
success

OK.

{ status: 200,
  headers: '{"Accepts":"application/json"}',
  body: '{"userId":125363,"groupId":45690,"badges":[]}' }