CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: IGDB gather correct game data from correct console

  1. #1
    Join Date
    Aug 2008

    Question IGDB gather correct game data from correct console

    Hey all I am trying to figure this IGDB api out. I'm sure its powerful but it seems difficult to know what needs to be called and how since they don't have very good examples in their documents.

    So as an example say I am looking to get the box art and game info from the game "Mortal Kombat" and that I need it from the SNES version.

    Doing a normal search on their website brings up a lot of different Mortal Kombat.

    The Mortal Kombat that I am needing for the SNES is the 2nd to last here in the image. Mortal Kombat (1992).

    So I first have code to get id, cover, genres, name, platforms and screenshots:

    public partial class Gameinfo
            public long Id { get; set; }
            public long Cover { get; set; }
            public long[] Genres { get; set; }
            public string Name { get; set; }
            public long[] Platforms { get; set; }
            public long[] Screenshots { get; set; }
        using (var client = new HttpClient()) {
           using (var httpClient = new HttpClient { BaseAddress = baseAddress }) {
               httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
               httpClient.DefaultRequestHeaders.TryAddWithoutValidation("user-key", "##########################");
               using (
                   var response = await httpClient.GetAsync("games?search=" + HttpUtility.UrlEncode(game) + "&fields=*")
                   string responseData = await response.Content.ReadAsStringAsync();
                   gameData = JsonConvert.DeserializeObject<List<Gameinfo>>(responseData);
    The JSON response to the above is:

    You can see the first hit is Mortal Kombat II and the second is the one I am looking for, the original Mortal Kombat. So from the code above I get 2 main things I need in order to search "deeper". The Game ID and the Platforms ID(s). But with saying that - there lye's the problem. I am unable to just search for Mortal Kombat and automatically get the correct 1992 version.

    So without knowing the date that a game came out how can I search for the correct game with the needed platform of SNES?

    UPDATE 1

    So I tried doing the following:
        using (
            var response = await httpClient.GetAsync("games/?search=" + 
                           HttpUtility.UrlEncode("mortal kombat") + 
                           "&fields=name, = 19")
    But I always end up with the same data no matter what:
            "id": 81899,
            "name": "Mortal Kombat \u0026 Mortal Kombat II",
            "platforms": [
                "id": 22,
                "name": "Game Boy Color"
            "id": 119,
            "name": "Mortal Kombat",
            "platforms": [
                "id": 6,
                "name": "PC (Microsoft Windows)"
                "id": 9,
                "name": "PlayStation 3"

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: IGDB gather correct game data from correct console

    What format is the responseData string in?

    Are you sure it's json or does it contain html markup?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)