#1 Edited by invulnerable (1 posts) -

I'm trying to make a dynamic app to allow users to search by game name and expected year release. How would I go about making this call? I've tried:

http://www.giantbomb.com/api/games/?api_key=API_KEY&filter=expected_release_year:2013,name:battlefield3&format=json&limit=5&sort=original_release_date:asc

amoungst other things replacing the comma. How would I go about making this call to return both filters?

#2 Edited by soup_menu (202 posts) -

@invulnerable: You're most of the way there.

One issue is that the "name:battlefield3" filter won't ever return results. The there's a space between "battlefield" and "3" in the database, so you'd need to do "name:battlefield%203".

The other issue is that, per the API documentation, expected_release_year will be empty if original_release_date is set. I thought I was going to have to recommend using two queries--one for released games and another for unreleased ones--but it appears that the API will accept a request like:

http://www.giantbomb.com/api/games/?api_key=API_KEY&filter=expected_release_year:2013,original_release_date:2013-01-01%2000:00:00|2013-12-31%2023:59:59,name:battlefield%203&format=json&limit=5&sort=original_release_date:asc

In this case that still won't return any results, but that's only because Battlefield 3 came out in 2011. If you change the request like so:

http://www.giantbomb.com/api/games/?api_key=API_KEY&filter=expected_release_year:2011,original_release_date:2011-01-01%2000:00:00|2011-12-31%2023:59:59,name:battlefield%203&format=json&limit=5&sort=original_release_date:asc

...you'll get one hit.

Hope that helps!