Steam Web API/IEconService

From Valve Developer Community
< Steam Web API
Revision as of 19:08, 9 September 2013 by Al Farnsworth (talk | contribs) (Initial trade offer api documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The IEconService interface provides methods related to inventory and trading. See the Steam_Web_API page for more information about Web APIs.

Common Values

ETradeOfferState

These are the different states for a trade offer:

Name Value Comment
k_ETradeOfferStateInvalid 1 Invalid
k_ETradeOfferStateActive 2 This trade offer has been sent, neither party has acted on it yet.
k_ETradeOfferStateAccepted 3 The trade offer was accepted by the recipient and items were exchanged.
k_ETradeOfferStateCountered 4 The recipient made a counter offer
k_ETradeOfferStateExpired 5 The trade offer was not accepted before the expiration date
k_ETradeOfferStateCanceled 6 The sender cancelled the offer
k_ETradeOfferStateDeclined 7 The recipient declined the offer
k_ETradeOfferStateInvalidItems 8 Some of the items in the offer are no longer available (indicated by the missing flag in the output

CEcon_Asset

  • appid
  • contextid
  • assetid - either assetid or currencyid will be set
  • currencyid - either assetid or currencyid will be set
  • classid - together with instanceid, uniquely identifies the display of the item
  • instanceid - together with classid, uniquely identifies the display of the item
  • amount - the amount offered in the trade, for stackable items and currency
  • missing - a boolean that indicates the item is no longer present in the user's inventory

CEcon_TradeOffer

Both GetTradeOffers and GetTradeOffer return this structure:

  • tradeofferid - a unique identifier for the trade offer
  • accountid_other - your partner in the trade offer
  • message - a message included by the creator of the trade offer
  • expiration_time - unix time when the offer will expire (or expired, if it is in the past)
  • trade_offer_state - see ETradeOfferState above
  • items_to_give - array of CEcon_Asset, items you will give up in the trade (regardless of who created the offer)
  • items_to_receive - array of CEcon_Asset, items you will receive in the trade (regardless of who created the offer)
  • is_our_offer - boolean to indicate this is an offer you created.
  • time_created - unix timestamp of the time the offer was sent
  • time_updated - unix timestamp of the time the trade_offer_state last changed.

GetTradeOffers (v1)

This API gets a list of trade offers for the account associated with the WebAPI key. You cannot call this API for accounts other than your own.

Input

Either get_sent_offers or get_received_offers (or both) must be set. active_only and historical_only are optional, if neither is passed it is equivalent to both being set.

  • get_sent_offers - return the list of offers you've sent to other people.
  • get_received_offers - return the list of offers you've received from other people.
  • get_descriptions - return item display information for any items included in the returned offers.
  • language - needed if get_descriptions is set, the language to use for item descriptions.
  • active_only - return only trade offers in an active state (offers that haven't been accepted yet), or any offers that have had their state change since time_historical_cutoff.
  • historical_only - return trade offers that are not in an active state.
  • time_historical_cutoff - a unix time value. when active_only is set, inactive offers will be returned if their state was updated since this time. Useful to get delta updates on what has changed. WARNING: If not passed, this will default to the time your account last viewed the trade offers page. To avoid this behavior use a very low or very high date.

Output

  • trade_offers_sent - if get_sent_offers was set, this will be an array of CEcon_TradeOffer values that you have sent.
  • trade_offers_recieved - if get_received_offers was set, this will be an array of CEcon_TradeOffer values that have been sent to you.
  • descriptions - if get_descriptions was set, this will be a list of item display information. This is associated with the data in the items_to_receive and items_to_give lists via the classid / instanceid identifier pair.