Difference between revisions of "WebAPI"

From Team Fortress Wiki
Jump to: navigation, search
(Bolded title of page, Cleanup)
(Undo edit by Rolandius (Talk) (738671) Again, no.)
Line 1: Line 1:
The Steam '''WebAPI''' is documented [http://steamcommunity.com/dev here] and [http://developer.valvesoftware.com/wiki/Steam_Web_API here]. The mapping of the WebAPI data to each data format is described in the latter link.
+
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 WebAPI calls that allow you to retrieve information from the item system in ''Team Fortress 2''.
+
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 WebAPI require a valid Steam WebAPI key to function. You can get your own WebAPI key [http://www.steamcommunity.com/dev/apikey here]. Each example URL will only work after replacing "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" with your WebAPI key.
+
Calls to the TF2 Web API require a valid Steam Web API key to function. You can get your own API Key [http://www.steamcommunity.com/dev/apikey here]. Each example URL will only work after replacing "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" with your API key.
  
 
== Common elements ==
 
== Common elements ==
 +
 
=== Arguments ===
 
=== Arguments ===
 +
 
All TF2 methods take the following arguments in their URL:
 
All TF2 methods take the following arguments in their URL:
  
*'''key''': Your Steam WebAPI key. Without this, the server will return a 403 Forbidden HTTP status.
+
*'''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 ("'''<tt>json</tt>'''" for JSON, "'''<tt>xml</tt>'''" for XML, or "'''<tt>vdf</tt>'''" for VDF). The structure of the data for each format is described [http://developer.valvesoftware.com/wiki/Steam_Web_API#Formats here]. If a format is not specified, the data will be returned with the default of JSON.
+
*'''format''' ''(optional)'': The format to return the data in ("'''<tt>json</tt>'''" for JSON, "'''<tt>xml</tt>'''" for XML, or "'''<tt>vdf</tt>'''" 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 ===
 
=== Result structure ===
All TF2 methods return a "'''<tt>result</tt>'''" object containing a status code (at "'''<tt>status</tt>'''"), and either the data requested or a status message explaining why the data was not returned (at "'''<tt>statusDetail</tt>'''").
+
 
 +
All TF2 methods return a "'''<tt>result</tt>'''" object containing a status code (at "'''<tt>status</tt>'''") and either the data requested or a status message explaining why the data was not returned (at "'''<tt>statusDetail</tt>'''").
  
 
=== Terminology ===
 
=== 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, "<tt>TF_Weapon_Jar</tt>" is defined as "<tt>[[Jarate|Jar Based Karate]]</tt>" in "tf/resource/tf_english.txt" (as found in "team fortress 2 content.gcf").
+
 
 +
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, "<tt>TF_Weapon_Jar</tt>" is defined as "<tt>[[Jarate|Jar Based Karate]]</tt>" in tf/resource/tf_english.txt (as found in "team fortress 2 content.gcf").
  
 
== Methods ==
 
== Methods ==
 +
 
* [[/GetSchema|GetSchema]]
 
* [[/GetSchema|GetSchema]]
 
* [[/GetPlayerItems|GetPlayerItems]]
 
* [[/GetPlayerItems|GetPlayerItems]]
  
 
== Notes ==
 
== Notes ==
 +
 
=== List of valid IDs ===
 
=== List of valid IDs ===
 +
 
{{anchor|appids}}
 
{{anchor|appids}}
 
* 440: Team Fortress 2
 
* 440: Team Fortress 2
Line 29: Line 37:
 
* 620: Portal 2
 
* 620: Portal 2
  
=== Methods requiring a 64-bit user ID ===
+
=== 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.
+
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 ==
 
== Implementations ==
* [http://developer.valvesoftware.com/wiki/Steam_Condenser Steam Condenser] Ruby, PHP, and Java library
+
 
* [http://github.com/swixel/tf2webappy TF2 Web APpy] A small Python class.
+
* [http://developer.valvesoftware.com/wiki/Steam_Condenser Steam Condenser] Ruby, PHP, and Java library.
 +
* [http://github.com/swixel/tf2webappy TF2 Web APpy] A small Python class.
 
* [http://git.optf2.com/steamodd.git Steamodd] Python module
 
* [http://git.optf2.com/steamodd.git Steamodd] Python module
 
** [http://optf2.com OPTF2] online viewer
 
** [http://optf2.com OPTF2] online viewer
* [http://github.com/yaakov-h/libsc libsc] An Objective-C library for iOS (4.0+) and framework for Mac OS X (10.6+).
+
* [http://github.com/yaakov-h/libsc libsc] An Objective-C library for iOS (4.0+) and framework for Mac OS X (10.6+)
  
 
== See also ==
 
== See also ==
 +
 
* [[Talk:WebAPI/Feedback|Feedback]] for requests, suggestions, and issues.
 
* [[Talk:WebAPI/Feedback|Feedback]] for requests, suggestions, and issues.
* [http://developer.valvesoftware.com/wiki/Steam_Web_API Steam WebAPI] – For more information and other methods.
+
* [http://developer.valvesoftware.com/wiki/Steam_Web_API Steam Web API] for more information and other methods.
  
 
[[Category:Valve]]
 
[[Category:Valve]]
 
[[Category:WebAPI| ]]
 
[[Category:WebAPI| ]]

Revision as of 14:49, 25 September 2011

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

List of valid IDs

  • 440: Team Fortress 2
  • 520: Team Fortress 2 Public Beta
  • 620: Portal 2

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