postman Steam Web API密钥不起作用403禁止

xqkwcwgp  于 7个月前  发布在  Postman
关注(0)|答案(1)|浏览(137)

我正在Steam中尝试GET请求(GetUserStatsForGame)(https://partner.steamgames.com/doc/webapi/ISteamUserStats
,但它不工作的输出是这样的:


的数据
我的apiUrl = "https://partner.steam-api.com/ISteamUserStats/GetUserStatsForGame/v2/?key={{apiKey}}&steamid={{steamId}}&appid={{appIdCS2}}"
我在postman中尝试了一下,希望得到一个XML格式的响应。

relj7zay

relj7zay1#

在postman中,仔细检查你的API Key是否被正确地设置为一个变量。如果你将鼠标悬停在{{apiKey}}上,你可以编辑它并确认。你也可以像我下面展示的那样硬编码它。为了确保它是xml格式的,在url的末尾添加&format=xml

https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v2/?key=PASTEKEYHERE&steamid=PASTEID&appid=PASTEAPPID&format=xml

字符串
如果你在JavaScript中这样做,它可能看起来像这样,但请注意,我将{{VARIABLE}}改为${variable},以便动态地将变量值插入字符串。

// Replace these placeholders with your actual values
const apiKey = 'YOUR_ACTUAL_API_KEY';
const steamId = 'YOUR_STEAM_ID';
const appIdCS2 = 'YOUR_APP_ID';

https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v2/?key=${apiKey}&steamid=${steamId}&appid=${appIdCS2}&format=xml


我用我自己的API密钥测试了这两个,它似乎按预期工作。

相关问题