There isn't a real API for XBox Live, but I thought it would be fun to whip one up. This UDF is a bit ugly and needs to be cleaned. I'll release to CFlib once I've made it nicer. Right now it returns gamescore (nerd score!), a link to your gamer image, your last five games played, your XBox Live level, and a link to your XBox Live URL.
To get your data, you just pass in your XBox Live username:
<cfset info = getGamerCard('cfjedimaster')>
<cfset info2 = getGamerCard('boyzoid')>
I've attached the UDF and test code to this blog entry. Hopefully Microsoft will come to their senses and create a real API soon so we can avoid all this silly string parsing.
Archived Comments
Hey Ray,
FYI, Don't know if you've seen this or not but, Doug over at http://dougr.net has also made an XBOX Gamer Card POD for BlogCFC.
http://dougr.net/index.cfm/...
Oops, sorry about that link.. here's another try.
http://dougr.net/index.cfm/...
Ray's code accesses the gamercard data directly whereas what I did gets the card info provided from http://www.mygamercard.net/
Ray--this is pretty cool. I could see some neat uses for this. I am currently using Doug's gamercard pod, but could really have fun playing with data directly from Xbox Live.
Ya, I want to mess with this too. Having direct access using this API would offer allot more flexibility.
Ray, I am interested in discovery of a "webservice" like this. Did you just do a search or grab the URL off of your card at http://www.xbox.com?
D.
All the URLs followed standard format and result, so I just used that.
Ray, this is great.. Are there any examples on how i can turn this into a gamecard like the www.mygamercard.net? Or is it just a matter of comming up with design on our own?
You would just design it yourself.
Is there a way to get the users ranking or the images of the last five games they played?
I don't see a ranking but I do see the images. You could update my code to get them.
Ray, nice job here.. I am wondering if you could help show a newb like me a simple example on how to output this in a simple format. I am not really sure on how to pull each part and put it in a DIV or table..
Thanks
The result of the function is a structure. So to get the level, if you did
info = getGamerCard("cfjedimaster")
you could putput the level like so:
<cfoutput>#info.level#</cfoutput>
Notice in my demo I do a dump which shows all the available keys you can work with.
If I am calling a query to display a list of gamertags, is there a special way to call the function when going through a loop?
I am not really sure what the correct way is to call this function when going through a loop/query
<cfloop>
<cfset info = getGamerCard("#gamertag#")
</cfloop>
What is the best way to do something like this?
I figured it out.. Thank you for your time!!!