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:



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:




Author: Duncan Mackenzie

I'm the Developer Lead for the Channel 9 team, formerly worked on MSDN as a developer, content strategist and author.

29 thoughts on “Put up a REST API for Xbox Gamertag Data”

  1. 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?

  2. 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.

  3. 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!

  4. 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

  5. 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?

  6. 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.

  7. 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!

  8. 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”

  9. 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.


  10. 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.

  11. Hey I was wondering if anyone could help me retrieve induvidual items of data from the XML Document using PHP.

    I have so far:

    $xmlDoc = new DOMDocument();

    $x = $xmlDoc->documentElement;

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

  12. 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.


    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.’);


  13. 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″>

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

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

  14. 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!

  15. 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

  16. 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?

  17. 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 : )

  18. 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?

Leave a Reply to Sigurdur G. Gunnarsson Cancel reply