0

I try to use Steam-Web-Api first time and I've got some problem.

I want to get full list of games - in this case of my profile - I receive list with apiIds etc but each of game has null value in Name field.

Here is simple code:

public class SteamWebApiDemo {
    private static final String key = "MY_KEY";

    public static void main( String[] args ) throws SteamApiException {
        SteamWebApiClient client = new SteamWebApiClient.SteamWebApiClientBuilder( key ).build();
        GetOwnedGamesRequest req = new GetOwnedGamesRequest.GetOwnedGamesRequestBuilder( "76561198033046525" ).buildRequest();
        GetOwnedGames g = client.<GetOwnedGames> processRequest(req);

        for( com.lukaspradel.steamapi.data.json.ownedgames.Game game : g.getResponse().getGames() ) {
            System.out.println(
                    game.getAppid() + ": " + game.getName()
            );
        }
    }
}

In loop I try to extract appId and name, but each of game has null value and I just don't understand Why?

Short example:

10: null 20: null 30: null 40: null 50: null 60: null 70: null

Chriki
  • 15,638
  • 3
  • 51
  • 66
ullQuiorra
  • 31
  • 1
  • 6
  • That seems like a question [for the developer](https://github.com/lpradel/steam-web-api-java) – OneCricketeer Dec 21 '15 at 20:45
  • I don't think so. I use exactly the same examples from doc: https://developer.valvesoftware.com/wiki/Steam_Web_API I try to use these links from doc, link for OwnedGames works but I can see only 2 attributes BUT here is other problem, using correct game ID I have empty JSON. For example using id=10 for CounterStrike I receive empty JSON. Using GetGameSchema with the same ID exactly the same.... It's problem in valve or what? Sorry but I don't understand.... – ullQuiorra Dec 21 '15 at 20:50
  • I'm saying you could create an issue on Github explaining the problem as you've done here because it is that guy's code, and he may know exactly what your problem is. Maybe your key is wrong? Maybe your account is private and the information can't be read? No one can really know for sure except maybe the person that actually wrote the code. – OneCricketeer Dec 21 '15 at 20:54
  • Okay I'll try. It is not a problem with key or profile - my key is correct and profile is public - I'll try it in links from doc. But it is not only one problem. ID's from OwnedGame doesn't works for example I tried to use a few example ID's in SchemaGame using link from doc, and these ID's are wrong.... – ullQuiorra Dec 21 '15 at 20:58

1 Answers1

0

Short Answer

Make sure to set the designated request option include_appinfo in your request with the builder method includeAppInfo like so:

GetOwnedGamesRequest req = new GetOwnedGamesRequest.GetOwnedGamesRequestBuilder( "76561198033046525" ).includeAppInfo(true).buildRequest();

This will yield the desired result:

2100: Dark Messiah of Might & Magic Single Player ........

For further information please refer to the Steam API documentation for GetOwnedGames request.

Long Answer

I'm the maintainer of the library in question and randomly stumbled on this question only now. Obviously I'm rather late to answer it, sorry about that. But, as they say better late then never. Plus, others who stumble on this question may find the solution helpful.

For all Steam API requests it's worth taking a look at the API docs.

In this case there's an additional required parameter include_appinfo which can be set with a builder method on the request builder class. I've tried to include all optional parameters in my request builders but keep the default request as simple as possible. I can only speculate but I assume that include_appinfo would be disabled by default to reduce load on the Steam servers as it obviously requires a lot more data for each GetOwnedGames request.

Of course, the same can be achieved by leaving the option as false and instead following up with GetGameSchema requests for only the games you are interested in providing their appids. This will lead to multiple requests from the client but ultimately it's likely less load on the Steam servers, especially if the Steam user in question has a lot of games in their library.

lpradel
  • 33
  • 4
  • For completeness sake here is the [full discussion](https://github.com/lpradel/steam-web-api-java/issues/4) on this question and others by @ullQuiorra in a Github issue. – lpradel Jul 18 '22 at 21:05