New JSON Feed of Badge Info

Subscribe to New JSON Feed of Badge Info 14 posts, 8 voices

Sign in to reply


 
avatar for jimgreer jimgreer 555 posts
Flag Post

We’ve got a new feed that will be useful for people making things like the Kongregate Firefox Sidebar and Metaward. It’s actually two different kinds of feeds – one of all badges available, and one showing the badges any individual user has.

Andrew did them as JSON, which is a simpler and more compact format than XML. There are JSON parsing libraries for most popular languages, including AS2 & AS3.

Try it out – these might not look right in your browser, but you can download them as a file and open in notepad or whatever.

http://www.kongregate.com/badges.json

This feed returns the following info:

  1. Badge description
  2. Title and URL of the game(s) the badge is on
  3. Badge name
  4. URL of badge icon
  5. Badge difficulty / points earned
  6. How many users have earned it
  7. When it was created
  8. Unique id

http://www.kongregate.com/accounts/jimgreer/badges.json

This one returns the badges earned by the given user – it’s just a list of badge ids and the date earned.

You can also have these call a javascript function directly (sometimes useful if you’re doing an AJAX web app):

http://www.kongregate.com/accounts/andrew/badges.json?callback=foo

 
avatar for UnknownGuardian UnknownGuardian 1704 posts
Flag Post

Thanks! Didn’t see this till now. Great. I’d love to make an app. Is there anyway to get the name of an individual through the use of a method that requires only prompting once? (for mass distibuting, so you can just make one app)

 
avatar for jimgreer jimgreer 555 posts
Flag Post

Um, you could ask the user to input their username. Am I missing something?

 
avatar for dasmitimsad dasmitimsad 1544 posts
Flag Post

The sites do not work for me. :/

 
avatar for UnknownGuardian UnknownGuardian 1704 posts
Flag Post
Originally posted by jimgreer:

Um, you could ask the user to input their username. Am I missing something?

Well, I don’t want to distribute an app that each time you need to type in your username, nor do I want to make 500 different apps for the different users that might want a personalized app.

 
avatar for jonathanasdf jonathanasdf 1592 posts
Flag Post

uhh, that’s why you store it on the user’s computer/browser profile

 
avatar for UnknownGuardian UnknownGuardian 1704 posts
Flag Post
Originally posted by jonathanasdf:

uhh, that’s why you store it on the user’s computer/browser profile

But when you distribute the flash player app won’t its directory change as it might be uploaded to multiple different websites?

 
avatar for jonathanasdf jonathanasdf 1592 posts
Flag Post

Oh so you want to use a flash player app …

Then of course they will need to log in every time if they access it from a different computer/browser…. otherwise there’s a lot of room for security issues. Of course, they can still look at the list of all the badges (thus knowing when new ones come out) without logging in.

For sites like facebook if you put on a specialized version you can probably pull the username stuff from the facebook API and thus use it that way (i’m not sure). Of course, if you’re using FP10 you can always use ExternalInterface to access the browser (through javascript), and store the data that way. It can then be pulled across all the different versions of your app. However, whether that info is stored for a single session or forever is up to you, depending on whether it’d be violating any security policies if it’s stored forever…

 
avatar for paralaxx paralaxx 59 posts
Flag Post

The API is now being used for updating kong users on metaward. Yay!

Thank you very much for building it. It should save us both a ton of bandwidth and headaches.

How about a full dump of user’s badges, and a daily dump of changes in badges, so I don’t have to recrawl? ;)

Anyways, thanks again.

 
avatar for hero122 hero122 1325 posts
This post has been removed by an administrator or moderator
 
avatar for skyboy skyboy 1230 posts
Flag Post

would be interesting if you were to duplicate this for the games page (http://www.kongregate.com/games) which i expect the json file already exists, since http://www.kongregate.com/games.js and http://www.kongregate.com/games are the same exact page but http://www.kongregate.com/games.json returns a supposed 404 (you do this on other pages that do in fact exist (obvious from your calls to the pages from the holodeck and returning a value, to the ajax script), but the client doesn’t have proper permissions)

 
avatar for UnknownGuardian UnknownGuardian 1704 posts
Flag Post

Well there is 2 options then. You could do they incorrect thing and “hack” to get that. Or you could say please and you might receive it. I advise the second only and will personally ignore anyone who ever decides to hack.

 
avatar for skyboy skyboy 1230 posts
Flag Post

unknown, some things you can’t “hack,” not in the sense you mean anyway. there is no outside way to get to the badges.json; it’s all internal. other thing (your muted users, /accounts/#{user}/muted_users.json, however, is locked, but not blocked)

 
avatar for MostAwesomeDude MostAwesomeDude 4 posts
Flag Post

Cool. I ported the script I use to generate my profile stats, to this API. It’s nice.

$ ./kong.py jimgreer

Acquiring badges.json… OK!

Acquiring jimgreer.json… OK!

Acquiring jimgreer’s badges.json… OK!

- copy below this line -

November 19, 2009

- Acquired Badges: 228 of 851 (26.79% complete)

- Impossibles: 0 of 37 (0.00% complete)

- Average Points per Badge: 11.45

- Average Badges per Day: 0.20

- Estimated date of completion: June 21, 2018

- end of stats -

EDIT: http://github.com/MostAwesomeDude/madsnippets/blob/master/kong.py if you like. ~ C.

Sign in to reply


Click Here