json Steam Web API 获取 CS:GO 库存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25977803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 17:32:40  来源:igfitidea点击:

Steam web API getting CS:GO inventory

jsonsteamsteam-web-api

提问by Mathias_

Alright, so I have been looking for this all over the internet, and what I have found out is that when you want to get someones steam inventory you use this:

好的,所以我一直在互联网上寻找这个,我发现当你想要获得某人的 Steam 库存时,你可以使用这个:

http://api.steampowered.com/IEconItems_{appid}/GetPlayerItems/v0001/?key={apikey}&steamid={steamid}&format=json

But the problem is that when I do that for CS:GO (appid: 730), I just get an empty response back, even though the user has items in their inventory.

但问题是,当我为 CS:GO (appid: 730)执行此操作时,即使用户的库存中有项目,我也只会得到一个空响应。

回答by Michael 'kC' J.

if you want to get the json just use one of the following links:

如果您想获取 json,只需使用以下链接之一:

general steam inventory: ( 1: games, 3: coupons, 6: trading cards, 7: rewards )

Steam总库存:(1:游戏,3:优惠券,6:交易卡,7:奖励)

http://steamcommunity.com/id/<USERURL>/inventory/json/753/1
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/1

http://steamcommunity.com/id/<USERURL>/inventory/json/753/3
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/3

http://steamcommunity.com/id/<USERURL>/inventory/json/753/6
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/6

http://steamcommunity.com/id/<USERURL>/inventory/json/753/7
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/753/7

games :

游戏:

http://steamcommunity.com/id/<USERURL>/inventory/json/<APPID>/2
http://steamcommunity.com/profiles/<STEAMID>/inventory/json/<APPID>/2

the problem was not the counter-strike appid, you just used an old link that only works for the general steam inventory. I suggest you using the link using STEAMID because not every steamuser has set a customurl.

问题不在于反恐精英 appid,您只是使用了一个旧链接,该链接仅适用于一般 Steam 库存。我建议您使用使用 STEAMID 的链接,因为并非每个 Steam 用户都设置了自定义 URL。