WebAPI

From Team Fortress Wiki
Revision as of 00:43, 2 July 2010 by Joe (talk | contribs) (Steam Web APIs for Team Fortress 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Team Fortress 2 Web APIs

The following web API calls 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 here.

GetSchema (v0001)

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

Arguments

None

Return Value

Returns the item schema for the current build of Team Fortress 2. The schema is defined as follows:

{ 
  "result": 
  { 
      "status": 1, 
      "qualities": 
      { 
          "normal": 0, 
          "common": 1, 
          "rare": 2, 
          "unique": 3, 
          "community": 7, 
          "developer": 8, 
          "selfmade": 9 
      }, 
      "items": 
      { 
          "item": 
          [ 
              { 
                  "name": "TF_WEAPON_BAT", 
                  "defindex": 0, 
                  "item_class": "tf_weapon_bat", 
                  "item_type_name": "#TF_Weapon_Bat", 
                  "item_name": "#TF_Weapon_Bat", 
                  "item_slot": "melee", 
                  "item_quality": 0, 
                  "image_inventory": "backpack\/weapons\/c_models\/c_bat", 
                  "model_player": "models\/weapons\/w_models\/w_bat.mdl" 
              }, 
          ] 
      }, 
      "attributes": 
      { 
          "attribute": 
          [ 
              { 
                  "name": "damage penalty", 
                  "defindex": 1, 
                  "attribute_class": "mult_dmg", 
                  "min_value": 0.950000, 
                  "max_value": 0.850000, 
                  "description_string": "#Attrib_DamageDone_Negative", 
                  "description_format": "value_is_percentage", 
                  "effect_type": "negative" 
              }, 
          ] 
      } 
  } 
} 


The defindex fields in items and attributes corresponds with the same field in the GetPlayerItems calls.

GetPlayerItems (v0001)

The GetPlayerItems call returns a the items for the player specified. If a player has their Steam community profile set to Private you will not be able to retrieve their items.

Example URL: http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?steamID=12345678

Arguments

SteamID

Return Value

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 
                          } 
                      ] 
                  } 
              }, 
          ] 
      }
  } 
} 

If a player's profile is set to Private the status field will be set to 15 (Access Denied) and there will be no items field.