Put up a REST API for Xbox Gamertag Data

My twitter app uses a web service hosted on my site to get all the necessary Xbox Live info…. way more than the twitter app actually uses. This is a SOAP API, located here:

http://duncanmackenzie.net/services/XboxInfo.asmx

 

I know that some people prefer a more RESTful API though, so I also have another ‘page’ that you can call with a straight GET request and just pass the gamertag in as a query string parameter:

http://duncanmackenzie.net/services/GetXboxInfo.aspx?GamerTag=Festive+Turkey

 

Enjoy!

Put up a REST API for Xbox Gamertag Data

29 Responses

  1. thanx….

    fiestaxp May 29, 2007 at 6:15 am #
  2. Just wondering where you are getting your XBOX Live data from?

    Steve Daniels May 30, 2007 at 8:16 pm #
  3. Would you consider releasing the code for this? I am currently developing an Xbox live web service and am very interested in your work. You don’t appear to have a contact email address on this site, so perhaps you could get in touch with me through my website?

    Aaron Allport May 31, 2007 at 1:44 am #
  4. Thanks Duncan, once again you save me a couple hours of work.

    I’m also curious if the data is coming from a public source.

    dan June 2, 2007 at 12:25 am #
  5. im also working on an Xbox live web service and was wondering if you were going to realased the source code for the one with the GET peramater as i cant find anything like it on the net this is unique!

    Tim July 30, 2007 at 12:20 pm #
  6. Ditto to what everyone above said. Would love to know the code to retrieve this information myself as I wouldn’t want to use up your bandwidth for my own script usage.

    Alex Atkin UK October 26, 2007 at 1:19 am #
  7. Thanks a lot…

    I think the API will suit my purpose of use perfectly ๐Ÿ™‚

    Rono October 26, 2007 at 5:18 am #
  8. Hi Duncan,

    Awesome work! but like many here I’m VERY interested in how you did that webservice.

    I run a community site for Xbox users in Iceland and I’m working on a custom list of all the players here, what they are playing etc.

    Since I dont want to hammer your webservice with ~600 calls every 30-60 minutes every day, can you give any inforomation on how you wrote that webservice?

    I applied to the Xbox Community Developer program, but never got a reply ๐Ÿ™

    Best regards,
    Sigurdur G. Gunnarsson
    – Iceland / http://www.xbox360.is

    Sigurdur G. Gunnarsson October 26, 2007 at 3:17 pm #
  9. Is the API down? I was using it on a test I was doing and now I can not get it. XML call keeps telling me the doc is empty and I only added a cache method to the script?

    Russell October 28, 2007 at 2:29 pm #
  10. This service is great – though it’s a shame that MS has decided to limit who has access to the APIs for Xbox Live.

    Any chance that the server you connect to has the ability to get achievement info for a specified Gamertag? I’ve already written a small script to update Twitter with my Live status, but I’d also like to build something that can update based on Achievements that I earn.

    Josh December 5, 2007 at 8:07 pm #
  11. The time stamp for the last seen, is it PST? I see a -6:00 which makes me think that it is for central time.

    Russell January 14, 2008 at 3:02 pm #
  12. Just wanted to say thanks for providing these services!

    Dave Walker January 24, 2008 at 4:49 pm #
  13. This service is great! I’ve cooked up a nice little mod for Invision Power Board 2.3.x. It fits right into the user profile page for a nice list of games played, achievements and online status. It wouldn’t be possible without your link to XBL. Thanks!

    AnimuX February 4, 2008 at 10:50 pm #
  14. superb service i made a little friends list for my clan so we can see whos on and whos playing what

    wouldnt be possible without your nice service

    now i wanna work out how people can see when players unlock achievements and report it so i can get it to make a “10 recent achievement list”

    steven brown February 9, 2008 at 1:31 pm #
  15. Duncan, great post and info. I’ve been trying for a while to find something like this!

    One problem I have though…? I have consumed your webservice in VS2005 and I am trying to get back data for my GTag, but, I keep getting error: Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.

    I’d prefer to use the web service rather than a get method as it’s cleaner. Any help greatly appriciated. Ta.

    Tony

    Tony March 11, 2008 at 12:57 pm #
  16. I think this is the kind of program Ive been looking for. I am not sure since I know nothing of coding and/or how to use it. If you would be so kind as to maybe email me or even on this board let me know how to use this code, I would really appreciate it. Thanks.

    Dre March 14, 2008 at 10:37 pm #
  17. the easiest way to use the info is to use a xml parser and then use the info as you wish

    this is how i decided to use it
    http://brownmurder.10gbfreehost.com/

    i also made a gamertag learderboard and keep meaning to start a new project

    hope that help you on how to use the info

    steven brown March 15, 2008 at 7:02 pm #
  18. Hey I was wondering if anyone could help me retrieve induvidual items of data from the XML Document using PHP.

    I have so far:

    <?php
    $xmlDoc = new DOMDocument();
    $xmlDoc->load(“http://duncanmackenzie.net/services/GetXboxInfo.aspx?GamerTag=x2i4eva”]);

    $x = $xmlDoc->documentElement;

    foreach ($x->childNodes AS $item) {
    print $item->nodeName . ” = ” . $item->nodeValue . “
    “;
    }
    ?>

    Dan June 16, 2008 at 7:36 pm #
  19. Sorry for double post but the code i gave above has a ] after the gamertag that shouldnt be there.

    Dan June 16, 2008 at 7:40 pm #
  20. Dan,

    I use CURL to first cache the xml file on my own server then simplexml to access the xml file and process it into the PHP script.

    Example:

    if (file_exists($file)) {

    $xml = simplexml_load_file($file);

    foreach ($xml->RecentGames->XboxUserGameInfo as $games)
    {
    print ‘<br>’;
    print ‘<b>’ . $games->Game->Name . ‘</b><br> <br>’;
    print ‘Achievements: ‘ . $games->Achievements . ‘ of ‘ . $games->Game->TotalAchievements . ‘ possible.<br> <br>’;
    print ‘Gamer Score: ‘ . $games->GamerScore . ‘ of ‘ . $games->Game->TotalGamerScore . ‘ possible.<br>’;
    }

    } else {

    exit(‘Failed to open XML file.’);

    }

    AnimuX June 18, 2008 at 10:30 pm #
  21. I use this ColdFusion code to cache the xml file on my server. I then setup my server to automatically run this script every 30 minutes. I then have another page that actually uses the local xml file.

    <cfhttp url=”http://duncanmackenzie.net/services/GetXboxInfo.aspx?GamerTag=stolemygamertag” method=”get”>
    <cfhttpparam type=”header” name=”Accept-Encoding” value=”*” />
    <cfhttpparam type=”Header” name=”TE” value=”deflate;q=0″>
    </cfhttp>

    <cfset gamerinfo = XMLParse(trim(cfhttp.FileContent))>

    <cffile action=”write” file=”D:\Inetpub\razorrifh\gamerinfo\stolemygamertag.xml” output=”

    Ramon Ecung II June 24, 2008 at 8:30 pm #
  22. Thanks for the resource! I’ve integrated it with my personal site to show my gamer points on the last few games I’ve played. I use CSS to create bar charts of my progress.

    http://www.joshnichols.com/xbox/

    Josh N. August 27, 2008 at 4:54 am #
  23. Hello Duncan,
    Thank you for posting this great info! I guess I have the same questions as some of the people on this blog. Is it possible for you to tell me where you’re getting your data from Xbox Live?

    I am working on a website and don’t want to bog down your server with hundreds of request every hour. Thanks!

    HT September 12, 2008 at 5:40 pm #
  24. Hi Duncan
    Thanx for the API.
    This is surely something i was looking for!

    zp October 7, 2008 at 6:15 am #
  25. After about a day of trying to understand all this. I think I have a pretty good solution to simply displaying your Gamertag status. I have been searching for a way to accomplish this for such a long time. I'm so glad you have shown us the light Duncan!

    Also, big thanks to AnimuX for his code. It was a big help.

    Check out my implementation out here: http://michaelwschultz.com

    I have also written an article about how this is accomplished and have included all the source code here: http://idzr.org/e6swzs

    If you all have any questions feel free to contact me at michael@michaelwschultz.com

    Michael Schultz January 24, 2009 at 8:26 pm #
  26. This service is pretty cool… is the source available?

    MeeCoder January 29, 2009 at 5:07 am #
  27. Hi there, this seems pretty cool… However, could you provide the sourcecode for this?
    I just want to know how you get all the information from, and how you do it?

    tajbender January 31, 2009 at 9:09 pm #
  28. This seems to have stopped working. Using the REST api it just says everyone is an invalid gamertag. This is a great service and it would be a shame if it wasn't saved : )

    UL Legend FR February 3, 2009 at 9:16 pm #
  29. Duncan, is this completely not available any longer? I’m getting an IIS 404 when I try the links above, and based on the link that brought me here, it appears you switched to an MVC-based Web app at some point.

    Did the URL just change, or is it gone-gone?

    James Skemp November 16, 2011 at 7:52 am #

Leave a Reply