Difference between revisions of "WebAPI"

From Team Fortress Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The Steam Web API is documented at http://steamcommunity.com/dev and http://developer.valvesoftware.com/wiki/Steam_Web_API.
 
The Steam Web API is documented at http://steamcommunity.com/dev and http://developer.valvesoftware.com/wiki/Steam_Web_API.
  
This page documents the web API calls that allow you to retrieve information from the item system in Team Fortress 2. Each call requires a valid API Key to function. You can get your own API Key [http://www.steamcommunity.com/dev/apikey here].
+
This page documents the web API calls that allow you to retrieve information from the item system in Team Fortress 2.
 +
 
 +
Each example URL requires a valid API Key to replace "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" to function. You can get your own API Key [http://www.steamcommunity.com/dev/apikey here].
  
 
=== GetSchema (v0001) ===
 
=== GetSchema (v0001) ===
Line 59: Line 61:
 
Example URL: http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamID=84901 (returns the items in Robin Walker's inventory)
 
Example URL: http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamID=84901 (returns the items in Robin Walker's inventory)
  
== Status codes ==
+
=== Status codes ===
  
 
*'''1''': OK. Data returned as specified below.
 
*'''1''': OK. Data returned as specified below.

Revision as of 12:03, 2 July 2010

The Steam Web API is documented at http://steamcommunity.com/dev and http://developer.valvesoftware.com/wiki/Steam_Web_API.

This page documents the web API calls that allow you to retrieve information from the item system in Team Fortress 2.

Each example URL requires a valid API Key to replace "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" to function. You can get your own API Key here.

GetSchema (v0001)

This method returns the item schema for the current build of Team Fortress 2. It takes no additional parameters.

Example URL: http://api.steampowered.com/ITFItems_440/GetSchema/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&format=json

Status codes

  • 1: The normal code. Should always be returned.

Result data

  • "qualities": An object containing the numeric values corresponding to each "quality" an item can have (excluding three entries for the standard Medic weapons between the standard weapons and the unlockable weapons, which have the unlisted quality of 255):
    • "normal" (0): All of the standard inherent basic class weapons have this listed as their quality.
    • "common" (1): No weapons have this listed as their quality.
    • "rare" (2): No weapons have this listed as their quality.
    • "unique" (3): All other items have this listed as their quality.
    • "community" (7): No weapons have this as listed their quality.
    • "developer" (8): No weapons have this as listed their quality.
    • "selfmade" (9): No weapons have this as listed their quality.
  • "items": An object containing an array of "item":
    • "name": A string describing the item (eg. "Unique Achievement Feign Watch" for the Dead Ringer).
    • "defindex": The item's unique index as seen in GetPlayerItems.
    • "item_class": The item's class in game (ie. what you would use as the argument to "equip" in the console to equip it).
    • "item_type_name": The string containing pound-prefixed tokens for the string in TF2's language files that describes the item's class (ie. "#TF_Wearable_Shield" for the Chargin' Targe).
    • "item_name"
    • "item_slot"
    • "item_quality"
    • "image_inventory":
    • "model_player": The model to display for the item, or null if the object has no model.
    • "attributes" (Optional): If the item has gameplay effects, an object containing an array of "attribute":
      • "name": The attribute's "name" value (see below)
      • "class": The attribute's "attribute_class" value (see below)
      • "value":
  • "attributes": An object containing an array of "attribute":
    • "name": A name describing the attribute (eg. "scattergun has knockback" for the Force-A-Nature's knockback)
    • "defindex":
    • "attribute_class":
    • "minvalue":
    • "maxvalue":
    • "description_string":
    • "description_format":
    • "effect_type": "positive" if the effect is outright beneficial to the user (displayed in blue text in the item description window), "negative" if the effect is punitive to the user (red text), or "neutral" if the effect is more tangential to the normal behavior (eg. the Kritzkrieg's ubercharge being critical hits rather than invulnerability) (white text).

Further information

The first 32 items listed describe the original class weapons, with the name being the symbolic token for that weapon. The next 3 (defindex 32-35) describe abortive attempts at the original Medic unlockables, with the names being "Level 1 X" (where X is the name of the original item), and the original's art files defined (although the saw lists the Ubersaw's icon).

GetPlayerItems (v0001)

The GetPlayerItems call returns a the items for a specific player.

The player is specified with their Steam ID number, as the "SteamID" value in the URL arguments.

Example URL: http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamID=84901 (returns the items in Robin Walker's inventory)

Status codes

  • 1: OK. Data returned as specified below.
  • 8 ("SteamID parameter was missing"):
  • 15 ("Access Denied"): The player's profile is set to Private.

Result layout

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

{ 
  "result": { 
      "status": 1, 
      "items": { 
          "item": [ 
              { 
                  "id": 827, 
                  "defindex": 166, 
                  "level": 5, 
                  "quality": 3, 
                  "inventory": 2147483650, 
                  "quantity": 1, 
                  "attributes": 
                  { 
                      "attribute": [ 
                          { 
                              "defindex": 143, 
                              "value": 1272326400.000000 
                          } 
                      ] 
                  } 
              }, 
          ] 
      }
  } 
}