Difference between revisions of "WebAPI/GetPlayerItems"

From Team Fortress Wiki
Jump to: navigation, search
(Result Data: account_info)
(Bolded title of page, Spelling)
Line 1: Line 1:
This method returns the specified player's backpack content.
+
This documentation is for version v0001 of the '''WebAPI (GetPlayerItems)'''. This method returns the specified player's [[Backpack]] content.
 
 
This documentation is for version v0001 of GetPlayerItems.
 
  
 
== URL ==
 
== URL ==
 
 
<nowiki>http://api.steampowered.com/IEconItems_<ID>/GetPlayerItems/v0001/</nowiki>
 
<nowiki>http://api.steampowered.com/IEconItems_<ID>/GetPlayerItems/v0001/</nowiki>
  
 
See the [[WebAPI#appids|ID list]] for a valid ID.
 
See the [[WebAPI#appids|ID list]] for a valid ID.
  
== Method-specific Parameters ==
+
== Method-specific parameters ==
 
 
 
; SteamID
 
; SteamID
: The 64 bit ID of the user the backpack will be retrieved for.
+
: The 64-bit ID of the user the Backpack will be retrieved for.
 
 
== Status Codes ==
 
  
 +
== Status codes ==
 
*'''<tt>1</tt>''': OK. Data returned as specified below.
 
*'''<tt>1</tt>''': OK. Data returned as specified below.
 
*'''<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>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.
+
*'''<tt>15</tt>''' ("<tt>Permission denied</tt>"): The player's profile is set to "Private".
 
*'''<tt>18</tt>''' ("<tt>Unknown account</tt>"): The "steamID" parameter was not registered to an account.
 
*'''<tt>18</tt>''' ("<tt>Unknown account</tt>"): The "steamID" parameter was not registered to an account.
  
== Result Data ==
+
== Result data ==
 +
A list of the player's items is returned as follows:
  
A list of the player's items is returned, as follows:
+
;'''num_backpack_slots''': The number of Backpack slots this user has.
 
 
;'''num_backpack_slots''': The number of backpack slots this user has.
 
 
;'''items''': An object containing a list of associative arrays.
 
;'''items''': An object containing a list of associative arrays.
 
:;'''id''': The unique ID of the specific item.
 
:;'''id''': The unique ID of the specific item.
:;'''original_id''': The '''id''' of the item before it was customized, traded, or otherwise changed.
+
:;'''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]].
 
:;'''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.
 
:;'''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]].
+
:;'''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]].
:;'''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.
+
:;'''flag_cannot_trade''': A boolean value that is true if the item cannot be traded. This is true for items granted by an [[achievement]], [[purchase]]d 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).
+
:;'''inventory''': 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]]).
 
:;'''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_name''' ''(<span style="color: red;">Optional</span>)'': The item's custom name if it has one.
Line 40: Line 34:
 
:;'''style''' ''(<span style="color: red;">Optional</span>)'': An integer that can be used as an index to the item's [[../GetSchema#styles|style list]].
 
:;'''style''' ''(<span style="color: red;">Optional</span>)'': An integer that can be used as an index to the item's [[../GetSchema#styles|style list]].
 
:;'''attributes''' ''(<span style="color: red;">Optional</span>)'': If the item has additional effects to the ones normally associated with it as described in GetSchema, contains a list of associative arrays.
 
:;'''attributes''' ''(<span style="color: red;">Optional</span>)'': If the item has additional effects to the ones normally associated with it as described in GetSchema, contains a list of associative arrays.
::;'''defindex''': The index to the attributes definition in the schema. (eg. 133 for the medal number attribute for the [[Gentle Manne's Service Medal]]).
+
::;'''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 (eg. the medal number 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''' ''(<span style="color: red;">Optional</span>)'': The floating point value for this attribute if it has one.
 
::;'''float_value''' ''(<span style="color: red;">Optional</span>)'': The floating point value for this attribute if it has one.
::;'''account_info''' ''(<span style="color: red;">Optional</span>)'': Set on attributes with a Steam id as the '''value'''.
+
::;'''account_info''' ''(<span style="color: red;">Optional</span>)'': Set on attributes with a Steam ID as the value.
:::;'''steamid''': The specified user's unique 64-bit Steam id.
+
:::;'''steamid''': The specified user's unique 64-bit Steam ID.
 
:::;'''personaname''': The specified user's current name on Steam.
 
:::;'''personaname''': The specified user's current name on Steam.
  
== Inventory Token ==
+
== 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. A 1-bit integer in a class's slot indicates that the item is equipped in the appropriate loadout slot for that class. The low word contains the Backback 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:
  
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 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
 
   │ ┌─┬─┬─┬─┬─┬─────────────────────────────────────────────────── Unused
 
   │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── Engineer  
 
   │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── Engineer  
Line 63: Line 56:
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────── Sniper (or Atlas)
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────── Sniper (or Atlas)
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────── Scout (or P-Body)
 
   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌───────────────────────────────── 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 69: Line 62:
 
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 Backback 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 Backback 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 Backback slot 42
  
 
{{Languages|WebAPI/GetPlayerItems}}
 
{{Languages|WebAPI/GetPlayerItems}}
 +
 
[[Category:WebAPI|GetPlayerItems]]
 
[[Category:WebAPI|GetPlayerItems]]

Revision as of 05:48, 13 October 2011

This documentation is for version v0001 of the WebAPI (GetPlayerItems). This method returns the specified player's Backpack content.

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.

Status codes

  • 1: OK. Data returned as specified below.
  • 8 ("SteamID parameter was missing"): The "steamID" parameter of the URL was not included, or if present was not a valid SteamID64 value.
  • 15 ("Permission denied"): The player's profile is set to "Private".
  • 18 ("Unknown account"): The "steamID" parameter was not registered to an account.

Result data

A list of the player's items is returned as follows:

num_backpack_slots
The number of Backpack slots this user has.
items
An object containing a list of associative arrays.
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.
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 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 associative arrays.
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.

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. A 1-bit integer in a class's slot indicates that the item is equipped in the appropriate loadout slot for that class. The low word contains the Backback 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'
  │ ┌─┬─┬─┬─┬─┬─────────────────────────────────────────────────── Unused
  │ │ │ │ │ │ │ ┌───────────────────────────────────────────────── 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 Backback 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 Backback 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 Backback slot 42