Git Product home page Git Product logo

steam-web-api-java's Introduction

Hi there, I'm Lukas!

Twitter LinkedIn Visitors

Nice to meet you! My name is Lukas. I'm a software engineer at Deutsche Bahn Fernverkehr AG in ๐Ÿ‡ฉ๐Ÿ‡ช Frankfurt, Germany. I like bicycling and working out, video games and science fiction, open source software, the Ruhrpott and currywurst, whisk(e)y and red wine and riding my motorcycles ๐Ÿ๏ธ.

๐Ÿ“Š My GitHub stats

steam-web-api-java's People

Contributors

41zu avatar dependabot[bot] avatar josephbleau avatar lpradel avatar pazus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steam-web-api-java's Issues

Implement GetGlobalStatsForGame request

Currently the request type GetGlobalStatsForGame is not supported as the JSON structure of the returned data depends on the parameters given to the request, i.e. it is dynamic. It can therefore not be parsed to a POJO.

For starters, it would be possible to just return the entire response string.

After processing GetOwnedGames request and trying to access a single game field, its name is null.

As per title. I can't seem to get the steam App name.
GetOwnedGamesRequest request = SteamWebApiRequestFactory.createGetOwnedGamesRequest("/YOURSTEAMID/");
GetOwnedGames gog = SteamAPI.client.processRequest(request);
for(com.lukaspradel.steamapi.data.json.ownedgames.Game apiGame : gog.getResponse().getGames() ){
System.out.println(apiGame.getName());
}

The output of this foreach loop is null :(
The appID field is fine though.

image

Add Storefront API

Steam offers an additional so-called Storefront API. The available functions of this API should be implemented and made available in the same manner as the web API.

NoClassDefFoundError

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at com.lukaspradel.steamapi.webapi.client.SteamWebApiClient.(SteamWebApiClient.java:20)
at com.lukaspradel.steamapi.webapi.client.SteamWebApiClient$SteamWebApiClientBuilder.build(SteamWebApiClient.java:102)
at com.venum.steambot.SteamBot.main(SteamBot.java:13)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more

How can I fix this?

Processing GetOwnedGamesRequest throws exception java.lang.IllegalArgumentException

When using GetOwnedGames, processing the request throws java.lang.IllegalArgumentException due to Illegal character in query at index 125 in https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?format=json&key=3F66197689D7D799CC7378980235F678&input_json={"steamid":"76561198039505218"}

The character at index 125 is the opening curly brace, {. The URL is a valid call to a service interface but the brace causes the exception. Changing the steam ID does not resolve the issue.

Android ignoring Apache HTTPClient, causing crashes.

I am trying to use the API to create an application to find which of my games to play next on Android, however, when I build gradle I get these warnings:

WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages

WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages

And when I actually run, I have the following error:

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/utils/URIBuilder; at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getRequestUri(SteamWebApiRequestHandler.java:82) at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getRequestUrl(SteamWebApiRequestHandler.java:45) at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getWebApiResponse(SteamWebApiRequestHandler.java:33) at com.lukaspradel.steamapi.webapi.client.SteamWebApiClient.processRequest(SteamWebApiClient.java:40) at com.markapinis.steamgamefinder.Adapter.getView(Adapter.java:47)

Adapter.java:47 is as follows:
GetSchemaForGame schema = client.processRequest(request);

I have searched the internet for the last couple hours, each leading to different solutions which only cause different errors. So, I reverted back to the beginning and here I am.

Some research is pointing at the fact that Android already has an httpclient built in, and therefore ignores the Apache one that comes with the Maven (through gradle). However, I have not found any way to solve this problem.

Sorry if I have not been clear. If you need any other information, I can probably give it.

Problem with games

Hello,

I started work with your code but I have a few problems, I don't understand where is the problem so I hope you can help me.
So,

At the beginning I wanted test how works the game list. I did it:

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() );
    }
}

Here I want to extract MY games list and I want to show GameId and name BUT in result I get ID's where each name is NULL:

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

It is my first problem - Why I can't see name of all games?


Okay this problem is resolved. Should be .includeAppInfo(true).buildRequest(); For all names but still is problem with game_count I don't know right now if it is normal in Steam Web Api because it is count of all games + DLC's. In my example it is FEAR + some dlc. Here I have some suggestion to you, maybe make in games category for DLC?


Now is next problem much strange with documentation, maybe you can explain it to me. So,
I tried to use links from doc to get full list of my games:

http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=MY_KEY&steamid=76561198033046525&format=json

And I receive these games but only with 2 attributes appId and playtime_forever. Here is one problem:

"response": {
        "game_count":

game_count show wrong value, in this case shows 122 games where I have 118 on steam. - What is wrong here or what I didn't understand?

The last problem is with game Id. From upper list in JSON I tried to use a few ID's. For example here, ID=10 is for Counter Strike, so I tried to use again link from doc for SchemaGame:

http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=MY_KEY&appid=10

And in result I see this:

{
    "game": {

    }
}

For other example with other random ID I see this:

http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=MY_KEY&appid=58610

and in result I got this:

{
    "game": {
        "gameName": "ValveTestApp58610",
        "gameVersion": "13",
        "availableGameStats": {
            "achievements": [
........

Why as the game name I got "ValveTestApp58610" not real name?

Could you explain me where is the problem or what I did wrong?
For clarity, I have correct key and my profile is public on steam.

Stat exceeds integer value

I've seen an error in my logs which suggests that stats returned by the steam GetUserStatsForGame API can exceed integer values:

Caused by: com.fasterxml.jackson.core.exc.InputCoercionException: Numeric value (4294967260) out of range of int (-2147483648 - 2147483647)
 at [Source: (String)"{"playerstats":{"steamID":"76561198121152748","gameName":"Mordhau","stats":[{"name":"GameVersion","value":502402884},{"name":"FunRank","value":4294967260},{"name":"FunRankSamples","value":5004},{"name":"HeadsDecapitated","value":2988},{"name":"MeleeHeadHits","value":13891},{"name":"MeleeTorsoHits","value":70308},{"name":"MeleeLegHits","value":19546},{"name":"ProjectileHeadHits","value":473},{"name":"ProjectileTorsoHits","value":2620},{"name":"ProjectileLegHits","value":346},{"name":"FistKills",""[truncated 2071 chars]; line: 1, column: 154]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInputCoercion(ParserMinimalBase.java:637) ~[jackson-core-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.core.base.ParserMinimalBase.reportOverflowInt(ParserMinimalBase.java:606) ~[jackson-core-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:979) ~[jackson-core-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:887) ~[jackson-core-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:710) ~[jackson-core-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:526) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:506) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3677) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3645) ~[jackson-databind-2.14.2.jar:2.14.2]
	at com.lukaspradel.steamapi.webapi.client.SteamWebApiClient.processRequest(SteamWebApiClient.java:40) ~[steam-web-api-1.4.2.jar:?]

App ID: 629760
Steam User ID: 76561198121152748

I suggest the Stat class' value field to be changed to Long

Cheers

how get all game stats by user?

Hello, help me please, iam try to get user game stats, first iam try to do like this:

http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=570&key=949DDA17D1A94CB9D387F2BE0727EB5F&steamid=76561198140055626&include_appinfo=1

but for dota i just have this response:

{ "playerstats": { "steamID": "76561198140055626", "gameName": "[STAGING] DotA 2" } }

so now iam trying to get user game stats by this lib, but i dont understand what iam doing wrong:

        SteamWebApiClient client = new SteamWebApiClient.SteamWebApiClientBuilder( "949DDA17D1A94CB9D387F2BE0727EB5F" ).build();

        GetUserStatsForGameRequest request = new GetUserStatsForGameRequest.GetUserStatsForGameRequestBuilder("76561198140055626" ,570).buildRequest();

        GetOwnedGames g = null;
        try {
            g = client.processRequest(request);
        } catch (SteamApiException e) {
            e.printStackTrace();
        }

And also i have this error in Android:
FATAL EXCEPTION: main Process: com.ddpc.ggway, PID: 32475 java.lang.NoSuchMethodError: No static method encPath(Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String; in class Lorg/apache/http/client/utils/URLEncodedUtils; or its super classes (declaration of 'org.apache.http.client.utils.URLEncodedUtils' appears in /system/framework/org.apache.http.legacy.boot.jar) at org.apache.http.client.utils.URIBuilder.encodePath(URIBuilder.java:191) at org.apache.http.client.utils.URIBuilder.buildString(URIBuilder.java:152) at org.apache.http.client.utils.URIBuilder.build(URIBuilder.java:120) at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getRequestUri(SteamWebApiRequestHandler.java:83) at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getRequestUrl(SteamWebApiRequestHandler.java:45) at com.lukaspradel.steamapi.webapi.request.SteamWebApiRequestHandler.getWebApiResponse(SteamWebApiRequestHandler.java:33) at com.lukaspradel.steamapi.webapi.client.SteamWebApiClient.processRequest(SteamWebApiClient.java:40) at com.ddpc.ggway.ui.activity.MainActivity.onCreate(MainActivity.java:64) at android.app.Activity.performCreate(Activity.java:6679) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.