API Changes - Second Update

Announcements regarding our community.
Post Reply
User avatar
Zer0xFF
Posts: 330
Joined: Fri Apr 20, 2018 9:18 am

API Changes - Second Update

Post by Zer0xFF »

Hi everyone,

Today I'd like to announce 4 changes to the API:
  1. Last week I announced that `genre`, `developer` & `publisher` updates were inbound, so I'd like to confirm that `genre` & `developer` changes have been completed and those fields will be removed in favour of `genres` & `developers` within the next 24hours.
    • Note: `genres` & `developers` returns are json arrays containing IDs (example can be found below), and those IDs can be matched to an associated name through a list found at `/Genres` and `/Developers` respectively.
    • Note: the pending changes to `publisher` will follow the same trend and we hope to have that completed soon TM as well.

    Code: Select all

    {
      "code": 200,
      "status": "Success",
      "data": {
        "count": 1,
        "games": [
          {
            "id": 8901,
            "game_title": "Command & Conquer: The First Decade",
            "release_date": "2006-02-07",
            "platform": 1,
            "genres": [
              1,
              2,
              6
            ],
            "developers": [
              925,
              2579,
              10025,
              10026,
              10027
            ]
          }
        ]
      },
     [...]
    }
    
    1. this change will now allow us to provide a standard user selectable Genres and Developers (and Publishers) list to ensure consistent naming and ease of mass change if needed.
    2. this also means that we can now display list of games from a specific developer https://thegamesdb.net/listgames.php?dev_id=2808 while this change is currently exclusive to the website, it will be made available in the API as well.
  2. platform filter was something that should have been available from the start, but as the saying goes, better late than never.
    below is an example of a query with 2 platform filters, even if you have 1 platform you must use the array format as show
    Note: this filter only applies to `/Games/ByGameName` API endpoint, should there be a need for other filters here or another endpoint please feel free to make a forum post pointing that out for us.

    Code: Select all

    https://api.thegamesdb.net/Games/ByGameName?name=God+Of+War&filter[platform][]=39&filter[platform][]=12
    
    for consistency you should encode the square brakes first

    Code: Select all

    https://api.thegamesdb.net/Games/ByGameName?name=God+Of+War&filter%5Bplatform%5D%5B0%5D=39&filter%5Bplatform%5D%5B1%5D=12
    
    Edit: the array format `&filter[platform][]=39` will be removed in favour of a simpler list format `&filter[platform]=39,12`
  3. Small but significant update to update API endpoint, I've added argument `last_edit_id` which can be used instead of `time` to request the latest updates, a simple change, but should make checking for updates simpler.
  4. another note worthy change is that returned text (game_title, overview..etc) was being returned with html encoding, that now has been removed and any encoding applied will only be done by the JSON encoder itself (which your JSON parser should handle without any intervention on your behalf).
Finally, I want to announce 1 other change, `alternates` is now considered deprecated pending similar change as well, however, in this case a string array will be returned instead of an ID and `alternates` names will now take place in the search, lastly since `alternates` is in the plural form this field name will be retained but will contain the new data once the changes are ready to be published (so it's best to avoid using this field all together now), we hope this change along side publisher change will be the final change to the how the API work.

Regards
Zer0xFF
Regards
Zer0xFF

Post Reply