Openbadges.convertEmail()

To convert an earner email address to Backpack user ID

You can make a REST API request to the convert service in the Mozilla Backpack to convert an earner email to their user ID, which you can then use in your calls to the Displayer API.

Usage

Hover over inputs/exits for more info.

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


// To convert an earner email address to Backpack user ID

Openbadges.convertEmail({

emailAddress: '[email protected]',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Could not find a user by the email address `[email protected]`

mailNotFound: function (result) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

emailAddress required

An email address.

'[email protected]'

Exits

error

An unexpected error occurred.

mailNotFound

Could not find a user by the email address `[email protected]`

{
  status: 404,
  headers: '{"Accepts":"application/json"}',
  body: '{"status":"missing","error":"Could not find a user by the email address `[email protected]`"}'
}
success

OK.

{
  status: 200,
  headers: '{"Accepts":"application/json"}',
  body: '{"status":"okay","email":"[email protected]","userId":125363}'
}