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: 'tailot@gmail.com',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Could not find a user by the email address `your@address.org`

mailNotFound: function (result) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

emailAddress required

An email address.

'tailot@gmail.com'

Exits

error

An unexpected error occurred.

mailNotFound

Could not find a user by the email address `your@address.org`

{ status: 404,
  headers: '{"Accepts":"application/json"}',
  body: '{"status":"missing","error":"Could not find a user by the email address `your@address.org`"}' }
success

OK.

{ status: 200,
  headers: '{"Accepts":"application/json"}',
  body: '{"status":"okay","email":"tailot@gmail.com","userId":125363}' }