Get steam inventory

108 views
Skip to first unread message

Woland Defender

unread,
Apr 2, 2017, 4:37:15 AM4/2/17
to Steam Condenser
Hello. I want to use your API to get dota2 inventory. I use java.
This function SteamId id = SteamId.create(XXX);  causes no problems but I cant get the inventory.
I try to call:
 WebApi.setApiKey("YYY");
 Dota2Inventory inventory2 = Dota2Inventory.create(76561198106184535L, true);

it causes:
com.github.koraktor.steamcondenser.exceptions.WebApiException: The Web API request has failed due to an HTTP error: Internal Server Error (status code: 500).
The full log I added in file log.txt

call of this: GameInventory inv = GameInventory.create(570, XXX);  causes the same.

What else should I add to make this function work correctly?
log.txt

Sebastian Staudt

unread,
Apr 3, 2017, 3:31:56 AM4/3/17
to Steam Condenser
Hi,

"Internal Server Error" is exactly that, a problem on Steam’s servers. The only thing you can probably do is retry later. On the other hand, the Web API (and especially Dota's inventory API) has become pretty unstable in the last two or even three years. And Valve doesn’t seem to be willing to fix these problems.

Best regards,
    Sebastian

--
You received this message because you are subscribed to the Google Groups "Steam Condenser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to steam-condens...@googlegroups.com.
To post to this group, send email to steam-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/steam-condenser/f918e6a0-390e-4873-8582-4be5367b0fe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Woland Defender

unread,
Apr 3, 2017, 4:22:05 AM4/3/17
to Steam Condenser
But if I paste in the browser this query generated by Querying Steam Web API: https://api.steampowered.com/IEconItems_570/GetPlayerItems/v0001/?SteamID=76561198106184535&format=json&key=somekey (from server logfile), it returns some json information that seemed to be correct

понедельник, 3 апреля 2017 г., 17:31:56 UTC+10 пользователь Sebastian Staudt написал:

Sebastian Staudt

unread,
Apr 3, 2017, 4:25:13 AM4/3/17
to Steam Condenser
Is this a „clean“ browser session? You might try a private / incognito browser tab. Otherwise it seems that Steam evaluates your user data from a logged in Steam web session.

Woland Defender

unread,
Apr 3, 2017, 6:23:09 AM4/3/17
to Steam Condenser
In private browser the query returns the same json.
Am I right that I try to get the inventory by calling this function?
Dota2Inventory inventory2 = Dota2Inventory.create(76561198106184535L, true);
may be I should call something else? Initialize sth?

понедельник, 3 апреля 2017 г., 18:25:13 UTC+10 пользователь Sebastian Staudt написал:

Sebastian Staudt

unread,
Apr 4, 2017, 3:29:24 PM4/4/17
to Steam Condenser
I'll try to reproduce this. Looks like Steam might make differences between user agents.

Woland Defender

unread,
Apr 7, 2017, 2:39:05 AM4/7/17
to Steam Condenser
Meanwhile if I call this with argument false Dota2Inventory inventory = Dota2Inventory.create("demomenz",false); it works good, but when I try to fetch inventory.fetch(); it throws an exception

среда, 5 апреля 2017 г., 5:29:24 UTC+10 пользователь Sebastian Staudt написал:

Sebastian Staudt

unread,
Apr 7, 2017, 2:57:59 AM4/7/17
to Steam Condenser
Setting the second parameter to `true` will effectively cause `fetch()` to be triggered right after creating the object, so this is expected.

Woland Defender

unread,
Apr 7, 2017, 3:57:51 AM4/7/17
to Steam Condenser
Yes, I was setting it to 'true' but this caused the error too.
There is one more point that I forgot to say. If I manualy change "secret" to "mysecretkey" (from http://steamcommunity.com/dev/apikey) in community.WebApi.java
 if (LOG.isInfoEnabled()) {
            String debugUrl = (apiKey == null) ?
                url : url.replace(apiKey, "mysecretkey");  //secret 
            LOG.info("Querying Steam Web API: " + debugUrl);
        }

in log I can see that it generates query
17:45:47,921 INFO  [com.github.koraktor.steamcondenser.community.WebApi] (http--0.0.0.0-8080-2) Querying Steam Web API: https://api.steampowered.com/IEconItems_570/GetPlayerItems/v0001/?SteamID=76561197960563532&format=json&key=mysecretkey

but if I dont change that it generates bad query
17:45:47,921 INFO  [com.github.koraktor.steamcondenser.community.WebApi] (http--0.0.0.0-8080-2) Querying Steam Web API: https://api.steampowered.com/IEconItems_570/GetPlayerItems/v0001/?SteamID=76561197960563532&format=json&key=secret

Anyway in both way it doesnt work) but may be the problem associated with this aspect

пятница, 7 апреля 2017 г., 16:57:59 UTC+10 пользователь Sebastian Staudt написал:

Sebastian Staudt

unread,
Apr 7, 2017, 4:06:57 AM4/7/17
to Steam Condenser
The key is deliberately changed to "secret" to prevent accidentally leaking your real API key when copying logs.
The real key is used for the HTTP requests, of course.

Sebastian Staudt

unread,
Apr 22, 2017, 8:08:20 AM4/22/17
to Steam Condenser
Sorry for the delay.

Steam Condenser will automatically fetch the item schema for the game, i.e. Dota 2.

The JSON result is empty and the error code is 500.

In fact, this is a long known issue (IIRC more than 2 years) on Valve’s end. I fear there won't be any way to fix this.
I known there are publicly available VDF files containing the item schema available on Steam’s CDN.

This may be a way to workaround this issue, but it would need a VDF parser and some way to obtain the right file (it might change with Dota 2 updates).

Best regards,
     Sebastian

Woland Defender

unread,
Apr 26, 2017, 10:37:55 AM4/26/17
to Steam Condenser
Hello, thank you for your answer. Now I use http://steamcommunity.com/inventory/"+id+"/570/2?l=english to get inventory. But there is recently appeared new problem related to API. Could you say how to solve it. Recently authorization on my web page through steam became successfully conducted only with the second or third time. Here is log:

23:24:29,787 SEVERE [ru.dota2.util.Util] (Thread-73) null: com.github.koraktor.steamcondenser.exceptions.SteamCondenserException: XML data could not be parsed: Server returned HTTP response code: 500 for URL: http://steamcommunity.com/profiles/76561198330712190?xml=1
    at com.github.koraktor.steamcondenser.community.XMLData.<init>(XMLData.java:70) [classes:]
    at com.github.koraktor.steamcondenser.community.SteamId.fetchData(SteamId.java:356) [classes:]
    at com.github.koraktor.steamcondenser.community.SteamId.<init>(SteamId.java:325) [classes:]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://steamcommunity.com/profiles/76561198330712190?xml=1
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1627) [rt.jar:1.7.0_79]
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:986)
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:143)
    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:802)
    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
    at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177) [rt.jar:1.7.0_79]
    at com.github.koraktor.steamcondenser.community.XMLData.<init>(XMLData.java:68) [classes:]
    ... 6 more




суббота, 22 апреля 2017 г., 22:08:20 UTC+10 пользователь Sebastian Staudt написал:

Sebastian Staudt

unread,
Apr 26, 2017, 10:49:32 AM4/26/17
to Steam Condenser
The XML API has never been totally stable. HTTP code 500 means there’s a problem on Valve’s end.

Woland Defender

unread,
Apr 26, 2017, 11:47:47 AM4/26/17
to Steam Condenser
Maybe you have some suggestions on what to use instead of this XML?

четверг, 27 апреля 2017 г., 0:49:32 UTC+10 пользователь Sebastian Staudt написал:

Woland Defender

unread,
Apr 26, 2017, 1:01:19 PM4/26/17
to Steam Condenser
Ok, I understood that steam XML is gluchnaya hernya, I'll try to remake using json instead of xml

четверг, 27 апреля 2017 г., 0:49:32 UTC+10 пользователь Sebastian Staudt написал:
Reply all
Reply to author
Forward
0 new messages