Steam Web API: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added a skeleton of result data for GetNewsForApp)
Line 45: Line 45:


An '''appnews''' object containing:
An '''appnews''' object containing:
* '''appid''', the AppID of the game you want news of
* '''newsitems''', containing '''newsitem''' - an array of news item information:
** An ID, title and url.
** A shortened excerpt of the contents (to maxlength characters), terminated by "..." if longer than maxlength.
** A comma-separated string of labels and UNIX timestamp.


=== GetGlobalAchievementPercentagesForApp (v0001) ===
=== GetGlobalAchievementPercentagesForApp (v0001) ===

Revision as of 01:34, 6 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:

  • appid, the AppID of the game you want news of
  • newsitems, containing newsitem - an array of news item information:
    • An ID, title and url.
    • A shortened excerpt of the contents (to maxlength characters), terminated by "..." if longer than maxlength.
    • A comma-separated string of labels and UNIX timestamp.

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