npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

steam-web-api2

v2.0.3

Published

ES6 Version of DoctorMcKay's steam-webapi

Downloads

3

Readme

Steam WebAPI Client

This is yet another node.js module for the Steam WebAPI. I made it for myself because I'm sure none of the other modules are any good, but anyone is of course welcome to use it. Don't expect too many updates outside of fixing stuff.

It detects and handles errors from the X-eresult and X-error_message headers. It also requests gzip compression for responses.

Constructor

The constructor takes two arguments: key and localAddress.

const SteamWebAPI = require('steam-web-api2');
var api = new SteamWebAPI("yourapikey", "192.168.0.5");

The first argument is your API key. The second is the local IP address you want to make your requests from. Both are optional. If you don't provide an API key you can only use the methods that don't require one.

You can change your API key at any time by assigning it to the key property. Same goes for localAddress with the localAddress property.

Methods

Calling methods direclty

You can call methods like

api.IEconService.GetTradeHistory({
    steamid: 76561198194871150
});

Interfaces

{
  "IBroadcastService": [
      "PostGameDataFrame"
  ],
  "ICheatReportingService": [
      "ReportPlayerCheating",
      "RequestPlayerGameBan",
      "RemovePlayerGameBan",
      "GetCheatingReports",
      "RequestVacStatusForUser",
      "StartSecureMultiplayerSession",
      "EndSecureMultiplayerSession",
      "ReportCheatData"
  ],
  "IEconMarketService": [
      "GetMarketEligibility",
      "CancelAppListingsForUser",
      "GetAssetID",
      "GetPopular"
  ],
  "IEconService": [
      "GetTradeHistory",
      "FlushInventoryCache",
      "FlushAssetAppearanceCache",
      "FlushContextCache",
      "GetTradeOffers",
      "GetTradeOffer",
      "GetTradeOffersSummary",
      "DeclineTradeOffer",
      "CancelTradeOffer"
  ],
  "IGameInventory": [
      "GetHistoryCommandDetails",
      "GetUserHistory",
      "HistoryExecuteCommands",
      "SupportGetAssetHistory"
  ],
  "IGameNotificationsService": [
      "CreateSession",
      "UpdateSession",
      "EnumerateSessionsForApp",
      "GetSessionDetailsForApp",
      "RequestNotifications",
      "DeleteSession",
      "DeleteSessionBatch"
  ],
  "IGameServersService": [
      "GetAccountList",
      "CreateAccount",
      "SetMemo",
      "ResetLoginToken",
      "DeleteAccount",
      "GetAccountPublicInfo",
      "QueryLoginToken",
      "SetBanStatus",
      "GetServerSteamIDsByIP",
      "GetServerIPsBySteamID"
  ],
  "IInventoryService": [
      "AddItem",
      "AddPromoItem",
      "ConsumeItem",
      "ExchangeItem",
      "GetInventory",
      "GetItemDefs",
      "GetPriceSheet",
      "Consolidate",
      "GetQuantity"
  ],
  "IPlayerService": [
      "RecordOfflinePlaytime",
      "GetRecentlyPlayedGames",
      "GetOwnedGames",
      "GetSteamLevel",
      "GetBadges",
      "GetCommunityBadgeProgress",
      "IsPlayingSharedGame"
  ],
  "IPublishedFileService": [
      "QueryFiles",
      "SetDeveloperMetadata",
      "UpdateTags"
  ],
  "ISteamApps": [
      "GetAppBetas",
      "GetAppBuilds",
      "GetAppDepotVersions",
      "GetAppList",
      "GetCheatingReports",
      "GetPlayersBanned",
      "GetServerList",
      "GetServersAtAddress",
      "SetAppBuildLive",
      "UpToDateCheck"
  ],
  "ISteamCommunity": [
      "ReportAbuse"
  ],
  "ISteamEconomy": [
      "CanTrade",
      "FinalizeAssetTransaction",
      "GetAssetClassInfo",
      "GetAssetPrices",
      "GetExportedAssetsForUser",
      "GetMarketPrices",
      "StartAssetTransaction",
      "StartTrade"
  ],
  "ISteamGameServerStats": [
      "GetGameServerPlayerStatsForGame"
  ],
  "ISteamLeaderboards": [
      "DeleteLeaderboard",
      "FindOrCreateLeaderboard",
      "GetLeaderboardEntries",
      "GetLeaderboardsForGame",
      "ResetLeaderboard",
      "SetLeaderboardScore"
  ],
  "ISteamMicroTxn": [
      "AdjustAgreement",
      "CancelAgreement",
      "FinalizeTxn",
      "GetReport",
      "GetUserAgreementInfo",
      "GetUserInfo",
      "InitTxn",
      "ProcessAgreement",
      "QueryTxn",
      "RefundTxn"
  ],
  "ISteamMicroTxnSandbox": [
      "AdjustAgreement",
      "CancelAgreement",
      "FinalizeTxn",
      "GetReport",
      "GetUserAgreementInfo",
      "GetUserInfo",
      "InitTxn",
      "ProcessAgreement",
      "QueryTxn",
      "RefundTxn"
  ],
  "ISteamNews": [
      "GetNewsForApp",
      "GetNewsForAppAuthed"
  ],
  "ISteamPublishedItemSearch": [
      "RankedByPublicationOrder",
      "RankedByTrend",
      "RankedByVote",
      "ResultSetSummary"
  ],
  "ISteamPublishedItemVoting": [
      "ItemVoteSummary",
      "UserVoteSummary"
  ],
  "ISteamRemoteStorage": [
      "EnumerateUserPublishedFiles",
      "EnumerateUserSubscribedFiles",
      "GetCollectionDetails",
      "GetPublishedFileDetails",
      "GetUGCFileDetails",
      "SetUGCUsedByGC",
      "SubscribePublishedFile",
      "UnsubscribePublishedFile"
  ],
  "ISteamUserAuth": [
      "AuthenticateUser",
      "AuthenticateUserTicket"
  ],
  "ISteamUser": [
      "CheckAppOwnership",
      "GetAppPriceInfo",
      "GetFriendList",
      "GetPlayerBans",
      "GetPlayerSummaries",
      "GetPublisherAppOwnership",
      "GetPublisherAppOwnershipChanges",
      "GetUserGroupList",
      "GrantPackage",
      "ResolveVanityURL"
  ],
  "ISteamUserStats": [
      "GetGlobalAchievementPercentagesForApp",
      "GetGlobalStatsForGame",
      "GetNumberOfCurrentPlayers",
      "GetPlayerAchievements",
      "GetSchemaForGame",
      "GetUserStatsForGame",
      "SetUserStatsForGame"
  ],
  "ISteamWebAPIUtil": [
      "GetServerInfo",
      "GetSupportedAPIList"
  ],
  "IWorkshopService": [
      "SetItemPaymentRules",
      "GetFinalizedContributors",
      "GetItemDailyRevenue",
      "PopulateItemDescriptions"
  ]
}

get(iface, method, version[, input])

  • iface - The WebAPI interface that you want to use. The leading "I" is optional.
    • For example, IGameServersService or SteamUser.
  • method - The WebAPI method that you want to use.
    • For example, GetPlayerSummaries.
  • version - The numeric version of the method you want to use.
    • For example, 1.
  • input - Optional. An object containing the parameters you want to pass to this request.
    • You shouldn't provide key or format, as these will be filled automatically.
    • Array inputs (e.g. input[0]=foo&input[1]=bar) should be passed as JavaScript arrays. They will be serialized accordingly.

Returns promise

Performs a GET request to a method.

post(iface, method, version[, input])

Same as get except with a POST request.

Failure

On failure, you'll get back an Error object with the following properties:

  • statusCode - The HTTP status code of the response. This may be 200 if an error was detected elsewhere.
  • eresult - Only if Steam sends back an X-eresult header, this will be an EResult value.
  • message - A string describing the error that occurred. These are the conditions that are checked, in order from top to bottom:
    • If X-eresult is returned, is not 1, and X-error_message is returned, then this is the value of X-error_message; otherwise,
    • If X-eresult is returned and is not 1, then this is the string name of the EResult value (for example, NoMatch); otherwise,
    • If the HTTP status code is not 200, this is the HTTP status message (for example, Not Found or Unauthorized); otherwise,
    • If the received response wasn't valid JSON, then this is Malformed response

Response

Response data is parsed as JSON. If the top-level object contains exactly one property named response, then the value of the response property is returned. Otherwise, the parsed JSON is returned as-is.