Gamespot API: how to get data in JSON format?

Avatar image for avalloneandrea
#1 Posted by avalloneandrea (8 posts) -

I'd like to do some experimenting with the Gamespot API, so I have registered an account and grabbed an API key. I'm able to retrieve data in XML format, but I can't find how to switch the format to JSON. Could someone help me with this?

Avatar image for wemmick
#2 Posted by wemmick (368 posts) -

@avalloneandrea: Sure, you can get a JSON response by adding this to your query string: &format=json. Somehow that disappeared from the docs - we'll get it back in. Thanks!

Avatar image for avalloneandrea
#3 Edited by avalloneandrea (8 posts) -

Thank you very much, it's working now!

May I ask you another question? I'd like to get the top games by score, but the query `reviews?score:desc` is not working. Am I missing something or is not possibile to achieve this?

Avatar image for wemmick
#4 Posted by wemmick (368 posts) -

@avalloneandrea: The filter syntax is more like "&sort=field:direction", so in your case, give this a try: 'reviews?sort=score:desc'.

Avatar image for avalloneandrea
#5 Posted by avalloneandrea (8 posts) -

You are right, I have copy-pasted a wrong string. Anyway, tried with 'http://hiddenfallsgolfclub.com/api/reviews?format=json&sort=score:desc&api_key=xxxxxxxxxx' with no luck: I get the reviews in the default order (sorted by publish_date I guess).

Avatar image for wemmick
#6 Posted by wemmick (368 posts) -

@avalloneandrea: Indeed that sort is not working. We have a fix in, and I expect it be released tomorrow. Thanks for the heads-up!

Avatar image for avalloneandrea
#7 Posted by avalloneandrea (8 posts) -

The sort by score is working now, thank you very much @wemmick!

Can you explain to me how to use the filter by publish_date? I can't figure out how to filter the reviews published between two dates...

Also, do you think you can fix/add the filter by platform? Something like `http://hiddenfallsgolfclub.com/api/reviews?format=json&filter=platform:PC&api_key=xxxxxxxxxx` to get all the PC game reviews would be great.

Avatar image for wemmick
#8 Posted by wemmick (368 posts) -

@avalloneandrea: The date filter would look like http://hiddenfallsgolfclub.com/api/reviews/?format=json&filter=publish_date:1997-05-01%7C1997-07-03

And sorry, we don't currently have a filter on it for platforms, but I'll try to get it in the queue.

Avatar image for egraves2
#10 Posted by egraves2 (1 posts) -

@wemmick I am trying to filter games in the Gamespot API but the same list of games are generated each time. My url looks like: http://hiddenfallsgolfclub.com/api/games/?api_key=xxxxxxxx&format=json&limit=5&filter=genres:Action

Avatar image for wemmick
#11 Posted by wemmick (368 posts) -

@egraves2: That does appear to be a bug - we're looking into it.