Difference between revisions of "WebAPI/GetPlayerItems"

From Team Fortress Wiki
Jump to: navigation, search
(Added new fields)
 
(43 intermediate revisions by 16 users not shown)
Line 1: Line 1:
This method returns the specified player's backpack content.
+
== URL ==
 +
<nowiki>http://api.steampowered.com/IEconItems_<ID>/GetPlayerItems/v0001/</nowiki>
  
This documentation is for version v0001 of GetPlayerItems.
+
See the [[WebAPI#appids|ID list]] for a valid ID.
  
= URL =
+
== Method-specific parameters ==
 +
; SteamID
 +
: The 64-bit ID of the user the backpack will be retrieved for.
 +
 
 +
== Result data ==
 +
;result:
 +
 
 +
:;status: The status of the request.
 +
::;1: Success
 +
::;8: The steamid parameter was invalid or missing.
 +
::;15: Backpack is private.
 +
::;18: The Steam ID given does not exist.
 +
 
 +
:;num_backpack_slots: The number of backpack slots this user has.
 +
 
 +
:;items: A list of item objects.
 +
 
 +
::;id: The unique ID of the specific item.
 +
 
 +
::;original_id: The ID of the item before it was customized, traded, or otherwise changed.
 +
 
 +
::;defindex: The defindex of the item, as found in the item array returned from [[../GetSchema|GetSchema]].
 +
 
 +
::;level: The arbitrary "level" value of the item as displayed in the inventory.
 +
 
 +
::;quantity: The number of "uses" an item has, generally only has a value in excess of '1' on "usable items", such as the [[Dueling Mini-Game]].
  
<nowiki>http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/</nowiki>
+
::;{{API optional|origin<ref name="tf2specific">Specific to the TF2 interface.</ref>}}: An integer used to lookup an origin name via [[../GetSchema#origin|GetSchema]].
  
= Method-specific Parameters =
+
::;{{API optional|flag_cannot_trade}}: A boolean value that is true if the item cannot be traded. Assume false if not present.
  
; SteamID
+
::;{{API optional|flag_cannot_craft}}: A boolean value that is true if the item cannot be used in crafting. Assume false if not present.
: The 64 bit ID of the user the backpack will be retrieved for.
+
 
 +
::;inventory (<span style="color: red;">Partially deprecated</span><ref>Assume fields for equipped classes to be incorrect, favor '''equipped'''</ref>): An inventory token as described [[#Inventory_token|here]], or '0' if the item has been awarded and not yet found (placed in the backpack).
 +
 
 +
::;quality: The [[Rarity|quality]] of the item (see definition in [[../GetSchema|GetSchema]]).
  
= Status Codes =
+
::;{{API optional|custom_name}}: The item's custom name if it has one.
  
*'''<tt>1</tt>''': OK. Data returned as specified below.
+
::;{{API optional|custom_desc}}: The item's custom description if it has one.
*'''<tt>8</tt>''' ("<tt>SteamID parameter was missing</tt>"): The "steamID" parameter of the URL was not included, or if present was not a valid SteamID64 value.
 
*'''<tt>15</tt>''' ("<tt>Permission denied</tt>"): The player's profile is set to Private.
 
  
= Result Data =
+
::;{{API optional|contained_item}}: All the information for the item that this item contains for gift-wrapped items.
  
A list of the player's items is returned, as follows:
+
::;{{API optional|style}}: An integer that can be used as an index to the item's [[../GetSchema#styles|style list]].
  
;'''num_backpack_slots''': The number of backpack slots this user has.
+
::;{{API optional|attributes}}: If the item has additional effects to the ones normally associated with it as described in GetSchema, contains a list of objects.
;'''items''': An object containing an unsorted array of
+
:::;defindex: The index to the attributes definition in the schema, e.g. 133 for the medal number attribute for the [[Gentle Manne's Service Medal]].
:;'''item''':
+
:::;value: The value for this attribute for this item, e.g. the medal number for the [[Gentle Manne's Service Medal]].
::;'''id''': The unique ID of the specific item.
+
:::;{{API optional|float_value}}: The floating point value for this attribute if it has one.
::;'''defindex''': The defindex of the item, as found in the item array returned from [[../GetSchema|GetSchema]].
+
:::;{{API optional|account_info}}: Set on attributes with a Steam ID as the value.
::;'''level''': The arbitrary "level" value of the item as displayed in the inventory.
+
::::;steamid: The specified user's unique 64-bit Steam ID.
::;'''quantity''': How many of this item in the backpack, since all non-[[Rarity#Normal_items|normal items]] have a unique ID this is always 1.
+
::::;personaname: The specified user's current name on Steam.
::;'''flag_cannot_trade''': A boolean value that is true if the item cannot be traded. This is true for items granted by an [[Achievement]], purchased items, and certain promotional items.
 
::;'''inventory''': An inventory token as described [[#Inventory_Token|here]], or 0 if the item has been awarded but not yet found (placed in the backpack).
 
::;'''quality''': The [[Rarity|quality]] of the item (see definition in [[../GetSchema|GetSchema]]).
 
::;'''custom_name''' ''(<span style="color: red;">Optional</span>)'': The item's custom name if it has one.
 
::;'''custom_desc''' ''(<span style="color: red;">Optional</span>)'': The item's custom description if it has one.
 
::;'''contained_item''' ''(<span style="color: red;">Optional</span>)'': All the information for the item that this item contains for gift-wrapped items.
 
::;'''attributes''' ''(<span style="color: red;">Optional</span>)'': If the item has additional effects to the ones normally associated with it as described in GetSchema, an object containing an array of
 
:::;'''attribute''':
 
::::;'''defindex''': The index to the attributes definition in the schema. (eg. 133 for the medal number attribute for the [[Gentle Manne's Service Medal]]).
 
::::;'''value''': The value for this attribute for this item (eg. the medal number for the [[Gentle Manne's Service Medal]]).
 
::::;'''float_value''' ''(<span style="color: red;">Optional</span>)'': The floating point value for this attribute if it has one.
 
  
= Inventory Token =
+
::;{{API optional|equipped<ref name="tf2specific"></ref>}}: If the item is equipped, contains an array of equip information
 +
:::;class: The class the weapon is equipped to (numeric index).
 +
::::;0: Scout
 +
::::;1: Scout <ref>This is probably the correct mapping for the scout and all equipped fields with 0 in it will probably have this as well. I'm guessing this is either an off-by-one bug or a workaround of it</ref>
 +
::::;2: Sniper
 +
::::;3: Soldier
 +
::::;4: Demoman
 +
::::;5: Medic
 +
::::;6: Heavy
 +
::::;7: Pyro
 +
::::;8: Spy
 +
::::;9: Engineer
 +
:::;slot: The slot the weapon is equipped in (numeric index).
 +
::::;0: Primary
 +
::::;1: Secondary
 +
::::;2: Melee
 +
::::;4: Building
 +
::::;6: PDA2
 +
::::;7: Head
 +
::::;8: Misc 1
 +
::::;9: Action
 +
::::;10: Misc 2
 +
::::;65535: Set when the class had the item equipped previously.
  
The inventory token is a combination of class loadout flags and position in the player's backpack. This unsigned 32 bit number is split into two two-byte words. The high word contains flags for each class. A 1 bit in a class's slot indicates that the items is equipped in the appropriate loadout slot for that class. The low word contains the backback position with 0 being the upper left slot, 1 the second slot from the left on the top row, etc. See [[../Examples#GetPlayerItems_Inventory_Token|examples]]. Here it is visually:
+
== Inventory token ==
 +
The '''inventory token''' is a combination of class loadout flags and position in the player's backpack. This unsigned 32-bit integer is split into two two-byte words. The high word contains flags for each class. 1-bit in a class's slot indicates that the item is equipped in the appropriate loadout slot for that class. The low word contains the backpack position with '0' if the item has been awarded, but not yet found (placed in the backpack), '1' being the upper left slot, '2' the second slot from the left on the top row, etc. Here it is visually:
  
  
   ┌─────────────────────────────────────────────────────────────── Always 1
+
   ┌─────────────────────────────────────────────────────────────── Always '1'
   │ ┌─┬─┬─┬─┬─┬─────────────────────────────────────────────────── Unused
+
   │ ┌─┬─┬─┬─┬─┬─────────────────────────────────────────────────── Placed in Backpack<ref>This bit is 0 when the item has been placed in the backpack and has its own slot. It is 1 if it has been recently dropped/traded for and it hasn't been allocated a backpack space.</ref>
 
   │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── Engineer  
 
   │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── Engineer  
 
   │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────── Spy  
 
   │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────── Spy  
Line 55: Line 94:
 
   │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────── Demoman  
 
   │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────── Demoman  
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────────── Soldier  
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────────── Soldier  
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────── Sniper  
+
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────── Sniper (or Atlas)
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────── Scout  
+
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────── Scout (or P-Body)
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─ Backpack Position
+
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─ Backpack position
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
 
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Line 63: Line 102:
 
Examples:
 
Examples:
 
   1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1  Equipped Pyro item  
 
   1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1  Equipped Pyro item  
                                                                     in backback slot 9
+
                                                                     in backpack slot 9
 
   1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1  Unequipped item  
 
   1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1  Unequipped item  
                                                                     in backback slot 41
+
                                                                     in backpack slot 41
   1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0  Equipped by Pyro and Engy
+
   1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0  Equipped by Pyro and Engineer
                                                                     in backback slot 42
+
                                                                     in backpack slot 42
 +
 
 +
== Notes ==
 +
<references/>
  
{{Languages|WebAPI/GetPlayerItems}}
 
 
[[Category:WebAPI|GetPlayerItems]]
 
[[Category:WebAPI|GetPlayerItems]]

Latest revision as of 04:20, 21 October 2014

URL

http://api.steampowered.com/IEconItems_<ID>/GetPlayerItems/v0001/

See the ID list for a valid ID.

Method-specific parameters

SteamID
The 64-bit ID of the user the backpack will be retrieved for.

Result data

result
status
The status of the request.
1
Success
8
The steamid parameter was invalid or missing.
15
Backpack is private.
18
The Steam ID given does not exist.
num_backpack_slots
The number of backpack slots this user has.
items
A list of item objects.
id
The unique ID of the specific item.
original_id
The ID of the item before it was customized, traded, or otherwise changed.
defindex
The defindex of the item, as found in the item array returned from GetSchema.
level
The arbitrary "level" value of the item as displayed in the inventory.
quantity
The number of "uses" an item has, generally only has a value in excess of '1' on "usable items", such as the Dueling Mini-Game.
origin[1] (Optional)
An integer used to lookup an origin name via GetSchema.
flag_cannot_trade (Optional)
A boolean value that is true if the item cannot be traded. Assume false if not present.
flag_cannot_craft (Optional)
A boolean value that is true if the item cannot be used in crafting. Assume false if not present.
inventory (Partially deprecated[2])
An inventory token as described here, or '0' if the item has been awarded and not yet found (placed in the backpack).
quality
The quality of the item (see definition in GetSchema).
custom_name (Optional)
The item's custom name if it has one.
custom_desc (Optional)
The item's custom description if it has one.
contained_item (Optional)
All the information for the item that this item contains for gift-wrapped items.
style (Optional)
An integer that can be used as an index to the item's style list.
attributes (Optional)
If the item has additional effects to the ones normally associated with it as described in GetSchema, contains a list of objects.
defindex
The index to the attributes definition in the schema, e.g. 133 for the medal number attribute for the Gentle Manne's Service Medal.
value
The value for this attribute for this item, e.g. the medal number for the Gentle Manne's Service Medal.
float_value (Optional)
The floating point value for this attribute if it has one.
account_info (Optional)
Set on attributes with a Steam ID as the value.
steamid
The specified user's unique 64-bit Steam ID.
personaname
The specified user's current name on Steam.
equipped[1] (Optional)
If the item is equipped, contains an array of equip information
class
The class the weapon is equipped to (numeric index).
0
Scout
1
Scout [3]
2
Sniper
3
Soldier
4
Demoman
5
Medic
6
Heavy
7
Pyro
8
Spy
9
Engineer
slot
The slot the weapon is equipped in (numeric index).
0
Primary
1
Secondary
2
Melee
4
Building
6
PDA2
7
Head
8
Misc 1
9
Action
10
Misc 2
65535
Set when the class had the item equipped previously.

Inventory token

The inventory token is a combination of class loadout flags and position in the player's backpack. This unsigned 32-bit integer is split into two two-byte words. The high word contains flags for each class. 1-bit in a class's slot indicates that the item is equipped in the appropriate loadout slot for that class. The low word contains the backpack position with '0' if the item has been awarded, but not yet found (placed in the backpack), '1' being the upper left slot, '2' the second slot from the left on the top row, etc. Here it is visually:


  ┌─────────────────────────────────────────────────────────────── Always '1'
  │ ┌─┬─┬─┬─┬─┬─────────────────────────────────────────────────── Placed in Backpack[4]
  │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── Engineer 
  │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────── Spy 
  │ │ │ │ │ │ │ │ │ ┌───────────────────────────────────────────── Pyro 
  │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────── Heavy 
  │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────────────── Medic 
  │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────── Demoman 
  │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────────── Soldier 
  │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────── Sniper (or Atlas)
  │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────── Scout (or P-Body)
  │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─ Backpack position 
  │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Examples:

  1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1  Equipped Pyro item 
                                                                   in backpack slot 9
  1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1  Unequipped item 
                                                                   in backpack slot 41
  1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0  Equipped by Pyro and Engineer
                                                                   in backpack slot 42

Notes

  1. a b Specific to the TF2 interface.
  2. Assume fields for equipped classes to be incorrect, favor equipped
  3. This is probably the correct mapping for the scout and all equipped fields with 0 in it will probably have this as well. I'm guessing this is either an off-by-one bug or a workaround of it
  4. This bit is 0 when the item has been placed in the backpack and has its own slot. It is 1 if it has been recently dropped/traded for and it hasn't been allocated a backpack space.