WebAPI

From Team Fortress Wiki
Revision as of 20:26, 3 December 2010 by Joe (talk | contribs)
Jump to: navigation, search

The Steam Web API is documented at http://steamcommunity.com/dev and http://developer.valvesoftware.com/wiki/Steam_Web_API. The mapping of the API data to each data format is described on the latter.

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

Calls to the TF2 Web API require a valid Steam Web API key to function. You can get your own API Key here. Each example URL will only work after replacing "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" with your API key.

Common elements

Arguments

All TF2 methods take the following arguments in their URL:

  • key: Your Steam Web API key. Without this, the server will return a 403 Forbidden HTTP status.
  • format (optional): The format to return the data in ("json" for JSON, "xml" for XML, or "vdf" for VDF). The structure of the data for each format is described at

http://developer.valvesoftware.com/wiki/Steam_Web_API#Formats. If no format is specified, the data will be returned with the default of JSON.

Result structure

All TF2 methods return a "result" object containing a status code (at "status") and either the data requested or a status message explaining why the data was not returned (at "statusDetail").

Terminology

A "tokenized string" refers to a string containing "#"-prefixed tokens that are replaced with the equivalent string in the game's VDF for the chosen language. For instance, "TF_Weapon_Jar" is defined as "Jar Based Karate" in tf/resource/tf_english.txt (as found in "team fortress 2 content.gcf").

Methods

Notes

Using the WebAPI in the TF2 Public Beta

All of the methods available in the TF2 web API are also available in the beta. Just replace 440 in the URL with 520.

Methods Requiring a 64-bit User ID

If a user's 64 bit ID is not readily available it can be obtained either by an OpenID transaction or by fetching the XML version of the user's Community profile page. This is accomplished by adding ?xml=1 to a normal community URL (for example: http://steamcommunity.com/id/stragglerastic?xml=1) and reading the value given in the steamID64 tag.

Implementations

See also