Difference between revisions of "Steam Web API"

From Valve Developer Community
Jump to: navigation, search
(Other interfaces and methods: format)
(VDF (Valve Data Format))
Line 13: Line 13:
 
=== VDF (Valve Data Format) ===
 
=== VDF (Valve Data Format) ===
 
* This is Valve's internal data format, as seen in uses like TF2's "scripts" folder (available in "team fortress 2 client content.gcf"). TF2's GetSchema returns data similar to "items/items_game.txt" (although qualities are not expanded into objects with a "value" field).
 
* This is Valve's internal data format, as seen in uses like TF2's "scripts" folder (available in "team fortress 2 client content.gcf"). TF2's GetSchema returns data similar to "items/items_game.txt" (although qualities are not expanded into objects with a "value" field).
* It appears to be undocumented, but it works similarly to JSON's objects:
+
* Documentation of the format is in progress [[KeyValues|here]].
** A member is represented by a quoted string, followed by a newline and an open brace.
 
** A value is represented as a key-value pair of quoted strings on the same line separated by a tab character. Each sub-object is indented by one tab character.
 
 
* Arrays in the data are represented as a VDF array with the name of the type of the objects in the array, with a VDF array being an object with each item being prefixed with its numeric key as a quoted string.
 
* Arrays in the data are represented as a VDF array with the name of the type of the objects in the array, with a VDF array being an object with each item being prefixed with its numeric key as a quoted string.
 
* Null is represented as an empty string.
 
* Null is represented as an empty string.

Revision as of 15:49, 3 July 2010

Formats

Every method can return its results in 3 different formats: JSON, XML, and VDF. Each format represents the data described herein differently:

JSON

  • The API returns an object containing the named object with the result data.
  • Arrays are represented as an array with the name of the type of the objects in the array (ie. an object named "items" containing an array of objects of type "item" would be represented as an object named "items" containing an array named "item" containing several objects following the "item" structure).
  • Null is represented as JSON's null.

XML

  • XML Attributes are not used.
  • Arrays are represented as a series of sub-elements in the containing element of the type of the array.
  • Null is represented by the word "null" between the element's tags.

VDF (Valve Data Format)

  • This is Valve's internal data format, as seen in uses like TF2's "scripts" folder (available in "team fortress 2 client content.gcf"). TF2's GetSchema returns data similar to "items/items_game.txt" (although qualities are not expanded into objects with a "value" field).
  • Documentation of the format is in progress here.
  • Arrays in the data are represented as a VDF array with the name of the type of the objects in the array, with a VDF array being an object with each item being prefixed with its numeric key as a quoted string.
  • Null is represented as an empty string.

If no format is specified, the API will default to JSON.

Game interfaces and methods

Team Fortress 2 functions are described at http://wiki.teamfortress.com/wiki/WebAPI.

Other interfaces and methods

GetNewsForApp (v0001)

GetNewsForApp returns the latest of a game specified by its appID.

Example URL: http://api.steampowered.com/ISteamNews/GetNewsForApp/v0001/?appid=440&count=3&maxlength=300&format=json

Arguments

  • appid
    • AppID of the game you want the news of.
  • count
    • How many news enties you want to get returned.
  • maxlength
    • Maximum length of each news entry.
  • format
    • Output format. json (default), xml or vdf.

Result layout

An appnews object containing:

GetGlobalAchievementPercentagesForApp (v0001)

Returns on global achievements overview of a specific game in percentages.

Example: http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0001/?gameid=440&format=xml

Arguments

  • gameid
    • AppID of the game you want the news of.
  • format
    • Output format. json (default), xml or vdf.

Community data

The Steam community data interface (XML only) is described here: https://partner.steamgames.com/documentation/community_data