Currently, I am trying to get all the steam reviews from a particular game, using the method described in the Steamworks documentation:
https://partner.steamgames.com/doc/store/getreviews
However, when I try to get reviews for a game like Team Fortress 2 for example using the method:
http://store.steampowered.com/appreviews/440?json=1
I always get 20 reviews, due to the start_offset parameter.
Is there a way to get all the reviews in one method command, or do I have to create a loop with different start_offset?
Looks like Steam changed the API and now start_offset is not working, they changed it to cursor.
here is more info:
https://partner.steamgames.com/doc/store/getreviews
in simple words: you send eg.
http://store.steampowered.com/appreviews/10?json=1&cursor=*
and in return you get JSON with next cursor that you need to parse and use in next URL.
eg. "cursor": "AoIIPwYYanDTv+QB"
also you need to remember to encode cursor so next call would be like
http://store.steampowered.com/appreviews/10?json=1&cursor=AoIIPwYYanDTv%2BQB
Taplar mentioned it correctly in his comment. start_offset - reviews are returned in batches of 20, so pass 0 for the first set, then 20 for the next set, etc. You need to use the offset like this:
http://store.steampowered.com/appreviews/10?json=1&start_offset=0
http://store.steampowered.com/appreviews/10?json=1&start_offset=20
http://store.steampowered.com/appreviews/10?json=1&start_offset=40
For a game like DOTA 2 there are like 650,000+ reviews. If you imagine yourself in Valve's place it would make sense to limit API calls. So I think it's safe to say that there is no API for all reviews at once.
Related
Currently, I am trying to get all the steam reviews from a particular game, using the method described in the Steamworks documentation: https://partner.steamgames.com/doc/store/getreviews
However, when I try to get reviews for a game like Dota 2 for example using the method:
http://store.steampowered.com/appreviews/570?json=1&start_offset=9200
http://store.steampowered.com/appreviews/570?json=1&start_offset=9220
I always got the same return after a small offset. There should be more than 878,134 reviews for Dota 2. Why I got the same return before reaching the end? Thanks.
Not all reviews can be accessed with the method described in https://partner.steamgames.com/doc/store/getreviews . For example, for now, there are 18 reviews in http://store.steampowered.com/app/794820/Knights_of_Pen_and_Paper_2_Free_Edition/. But there is nothing in http://store.steampowered.com/appreviews/794820?json=1.
You need to specify day_range. Try set day_range=9223372036854775807
source https://www.reddit.com/r/devsteam/comments/7qxjho/steam_api_user_reviews_query/
I need to Geocode all the branches of a chain within a country or state currently I am able to fetch a single result but I need to get the data for all the branches.
https://maps.googleapis.com/maps/api/geocode/json?address=macdonaldsIndia&key="MY-API-Key"
I think I am missing some extra parameters that need to be passed in the api.Please suggest if I am missing something
Thanks in advance
You should look into Places API web service. With nearby search or text search you can get up to 60 results.
For example if I search 'macdonalds India' for location 28.661898,77.227396 with radius 50km I can get 22 results. 20 results in the first page and 2 results in second page that I get using page token parameter.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=macdonalds%20India&location=28.661898%2C77.227396&radius=50000&key=YOUR_API_KEY
https://maps.googleapis.com/maps/api/place/textsearch/json?pagetoken=CpQCDwEAANFmh2yBVwmsgsOuEDlbKLLHXYhkn7WZNsstXOHBatJm_Js2MwEPSwHb16ICXzdt5PYu37NYPTr17MBdM6c0fIqjlB7V5otC-55bjde7Ns3l9igjMvu_hePMn03WXiRaeT7PQ8eoVTNAJQu0OrINTFtNNtU7xCm1p6UIGAzMm_phr_ZL955wTTPtqWq3XadfsdAgkwdrl2lQEbbYXhikwo-SrSfKoH2scOYrdJQ4y3SaPx95BKLPjAz8D_RfncXzQ4jVJeamuITQXMAjr1DbzKPFFNiCP3Yq_Ps7iUiUZRW8cSi5XB9RGjQN8zCQCTKWYwTWCdwfz8f49dKmj8GLw0mMfLwjJaE9tNaT1ZiEB8FMEhAD9pDF_U4CbEN8qFcgEJWFGhQ0qCZwK5EHNlVqGqk9hCYpHw9p0Q&key=YOUR_API_KEY
Visually it looks like
Hope this helps!
I am new to Json and API.
But, for study now I am figuring out how to get specific game data from steam API.
I followed lots of process.. and get api code from steam.
At first, I thought that 'oh I can extract all of game data using my API code!'
but,,, there's a question.
Most of the JSON QUERY requires my API code.
But they print just single result (especially about certain ID)
I want to know about what game is best selling or played..
like the steamspy : http://steamspy.com/
But the steam API just offers only user stat and so on.
At this point, now I am highlight again. I am new to Json.
so.. I wonder, "Is it possible to extract game's specific data using steam API?"
Not the single user's data.
But the all of the game's list.
Thank you for reading.
I have done little research but I know you can colllect the game-names from Steam also the ID:s I
by using
http://api.steampowered.com/ISteamApps/GetAppList/v0001/
I believe then you can filtering with different criterias some stuff.
regarding the Steamspy
This may not answer the full question but why don't you just using Steamspys:s API
you can collect most played games:
http://steamspy.com/api.php
### genre ###
Returns games in this particular genre. Requires *genre* parameter and works like this:
* steamspy.com/api.php?request=genre&genre=Early+Access
### top100in2weeks ###
Returns Top 100 games by players in the last two weeks.
### top100forever ###
Returns Top 100 games by players since March 2009.
### top100owned ###
Returns Top 100 games by owners.
### all ###
Returns all games with owners data sorted by owners.
I hope this is to some help
Best regards
Xsi
Forgive me, I'm very new to using REST.
Currently I'm using SP2013 Odata (_api/web/lists/getbytitle('<list_name>')/items?) to get the contents of a list. The list has 199 items in it so I need to call it twice and each time ask for a different set of items. I figured I could do this by calling:
_api/web/lists/getbytitle('<list_name>')/items?$skip=100&$top=100
each time changing however many I need to skip. The problem is this only ever returns the first 100 items. Is there something I'm doing wrong or is $skip broken in the OData service?
Is there a better way to iterate through REST calls, assuming this way doesn't work or isn't practical?
I'm using the JSon protocol with the Accept Header equaling application/json;odata=verbose
I suppose the $top=100 isn't really necessary
Edit: I've looked it up more and, I'm not entirely sure of the terms here, but using $skip works fine if you're using the method introduced with SharePoint 2010, i.e., _vti_bin/ListData.svc/<list_name>?$skip=100
Actually, funny enough, the old way doesn't set a 100 item limit on returns. So skip isn't even necessary. But, if you'd like to only return a certain segment of data, you'd have to do something like:
_vti_bin/ListData.svc/<list_name>?$skip=x&$top=(x+y)
where each time through the loop you would have something like x+=y
You can either use the old method which I described above, or check out my answer below for an explanation of how to do this using SP2013 OData
Alright, I've figured it out. $skip isn't a command which is meant to be used at the items? level. It works only at the lists? level. But, there's a way to do this, actually much easier than what I wanted to do.
If you just want all the data
In the returned data, assuming the list you are calling holds more than 100 items, there will be a __next at d/__next (assuming you are using json). This __next (it is a double underscorce, keep that in mind. I had a few problems at first because I was trying to get d/_next which never returned anything) is the right URL to get the next set of items. __next will only ever be a value if there is another set of items available to get.
I ended up creating a RequestURL variable which was initially set to to original request, but was changed to d/__next at the end of the loop. Then the loop went and checked if the RequestURL was not empty before going inside the loop.
Forgive my lack of code, I'm using SharePoint Designer 2013 to make this, and the syntax isn't horribly descriptive.
If you'd only like a small set of data
There's probably a few situations where you would only want x amount of rows from your list each time you go through the loop and that's real easy to do as well.
if you just add a $top=x parameter to your request, the __next URL that comes back with the response will give you the next x rows from your list. Eventually when there are no rows left to return __next won't be returned with the response.
Don't forget that in order to use __next you need to have a
$skiptoken=Paged=TRUE
in the url as well.
I'm using the Drive API to list files from a collection which do not contain a certain string in their title.
My query looks something like this:
files().list(q="'xxxxx' in parents and not title contains 'toto'")
In my drive collection, I have 100 files, all contain the string "toto" in their title except for let's say 10 files.
I'm using pagination to retrieve the results 20 by 20, so I'm expecting to get only one page with the 10 files corresponding to my request. Surprisingly, the API returns 5 pages, with the first 4 having no results but with a nextToken page, and the files which are compliant with my request only come with the fifth page.
I'm still trying some use-cases here but it seems that it has something to do with the "not" operator. Like if the request was made without it, therefore returning 5 pages, but the results not corresponding to the request being removed from the response. It's very disturbing for me as I'm looking for the best performance here, and obviously having to make 5 requests to Drive instead of one single is not good for me. I'm also noticing that the results don't always come in the last page. I made the test with another collection, the results show up in the second page, but I still get 3 empty pages after that.
Am I missing something here ? Is this kind of behaviour "normal" ? I mean imagine if I had 1000 documents in my collection, having to make 50 requests to find only a few is not what I expect.
I have similar problem in files.list API. I tried to receive all three folders under root folder. I received result only on 342nd page. After several hours of researching I found some regularity in this strange behavior.
As I understood, the Drive API works in this way:
Detects something like index that best match your query
Selects first 20 records using index from step 1
Applies your filter: removes records that do not match your query
Rest is returned to you (maybe empty) with next page token.
The nextPageToken is looks like just OFFSET for the first record on next page in decided index, maybe it contains some information about query or index.
After base64 decode this token I found appropriate record number for next result in 121st position in decoded token.
Previously I built index of tokens using maxResults=1.
This is crazy, but I have no other explanation for observable behavior.
It is very useful for server because server do a very small work for search. From other side this algorithm must produce a lot of requests for pagenate whole list. But limitation for requests per second solve this problem.
Only You can do is pagenage and skip empty results. Do not forget about limitation of number of requests.
Do not try to find errors on your side. This is how Google Drive API works.
contains operator is working as a prefix matcher at the moment.title contains 'toto' will match "totolong" and "toto", but not "blahtoto".