How can I query for all available Open Badges?

401 Views Asked by At

I'm attempting to make a Challenge Board rails app, which is essentially a search engine for Open Badges.

I need to aggregate all of the Open Badges that are available to be earned.

I've been looking through the Open Badge code on Github, and I found this:

Badge.finders = {
  email: function (value, callback) {
    var query = "SELECT * FROM `badge` WHERE `user_id` = (SELECT `id` FROM `user` WHERE `email` = ?)";
    mysql.client.query(query, [value], callback);
  }
};

(located at https://github.com/mozilla/openbadges/blob/development/models/badge.js)

So, can I just play around with that query to get what I want? Maybe this is the wrong way to go about things. Does anyone know of a way to get all of the available Open Badges? I've looked through the Displayer API, but it looks to be just for displaying a particular user's public badges.

I've considered writing a bot that spams the email-to-Open-Badge converter, and then takes each valid email (one attached to a real user) and stores it's ID code. Then I could cycle through those IDs to JSON query like this: http://beta.openbadges.org/displayer/[id]/groups.json and then keep a hash of all the different badges. However, I don't want to make a bot. Additionally, that system wouldn't add badges that are available, but no one has earned yet.

Anyone know of a good solution for this?

1

There are 1 best solutions below

0
On BEST ANSWER

There isn't an API for querying all the badges available in the Mozilla backpack, because the backpack is a place to put badges. It doesn't actually offer them. Mozilla is working on a badge directory service to aggregate available open badges from different badge issuers, but it's only in the prototype stage. We're hoping it's available in the next 6 months.