Raised This Month: $51 Target: $400
 12% 

[TF2] Getting Client Backpack Data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 05-27-2015 , 14:19   [TF2] Getting Client Backpack Data
Reply With Quote #1

I want to be able to get a client's backpack data for TF2. From what I have seen the API URL is:

http://api.steampowered.com/IEconIte...SteamID=IDHERE

My steam IDs are:

Steam 2: STEAM_0:0:62757252
Steam 3: U:1:125514504
64-bit: 76561198085780232

This is the URL I have been trying:

http://api.steampowered.com/IEconIte...61198085780232

This is the actual backpack view on steam (it's public, as you can see):

http://steamcommunity.com/profiles/7...232/inventory/

I always get permission denied or errors when I try the steam API. What am I doing wrong? Thanks!

(I have no idea where this should be so I figure General is a good place, rather than Scripting.)
Potato Uno is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 05-27-2015 , 14:40   Re: [TF2] Getting Client Backpack Data
Reply With Quote #2

Nevermind, please disregard this. Apparently steam was taking a shit when I was trying (steam community was down) and was throwing errors as a result. The URL worked fine when the steam community came back online.

However, while searching around in google I found absolutely nothing useful and just pieced together random stuff until it worked. So as a rundown, I'll just describe how to use it so that some poor soul who wants to do what I did can follow along.

1. The steam API backpack URL is in the form of:

PHP Code:
http://api.steampowered.com/IEconItems_APPID/GetPlayerItems/v0001/?key=KEYHERE&format=FORMAT&SteamID=STEAMID 
where

APPID = the game ID (TF2 is 440 CS:GO is 730 or something); you can find this on google or steam
KEYHERE = your steam API key (get it here http://steamcommunity.com/dev/apikey)
FORMAT = format in which you want your data to be returned in. "xml" for XML, "json" for JSON, and I THINK "vdf" works for keyvalues (but I never tried vdf).
STEAMID = The 64-bit (yes, 64-bit) steam ID of the player's backpack you want to inspect

So for my case it was

PHP Code:
http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/?key=KEYHERE&format=xml&SteamID=76561198085780232 
(with "KEYHERE" replaced by my API key)

As for 64-bit steam IDs, if you have steam 2 or steam 3 IDs, you can convert them to 64 bit.

For steam 2:

STEAM_X:Y:Z ----> 2*Z + Y + 76561197960265728

So in my case with STEAM_0:0:62757252, X = 0, Y = 0, Z = 62757252, so my 64-bit is 76561198085780232.

For steam 3:

For some steam 3 ID in the form of U:1:A, if A is an odd number, X = (A - 1)/2, Y = 1. If A is an even number, X = A/2, Y = 0. Then the 64-bit ID can be found by using the same equation above as the steam 2 ID (note: this is how you convert steam 3 to steam 2, although I don't think this is entirely correct but it correlates well).\

This PDF I found is useful for turning the 64-bit ID to steam 2 ID (which can then be turned to steam 3 ID):

PDF: http://www.martinpace.com/downloads/...ommunityID.pdf
Converting steam 2 to 3: http://forums.steampowered.com/forum...52&postcount=4

Last edited by Potato Uno; 05-27-2015 at 14:50. Reason: Wrong words; added solution
Potato Uno is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-28-2015 , 06:44   Re: [TF2] Getting Client Backpack Data
Reply With Quote #3

I believe the XML api is deprecated.
__________________
WildCard65 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-28-2015 , 08:40   Re: [TF2] Getting Client Backpack Data
Reply With Quote #4

Quote:
Originally Posted by WildCard65 View Post
I believe the XML api is deprecated.
The XML API != the XML response format for the Web API.
__________________
asherkin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode