Unaffiliated

Home Documentation & Help
Steamworks Documentation
GetContextContents/v0001
This returns the all of the assets and currency in a particular context for a user.

Called by: Trading UI, Inventory UI

HTTP Method: GET

Parameters:

NameTypeRequiredDescription
appiduint3232bit App ID of the application associated with the assets.
steamiduint6464-bit Steam ID of the user to return assets for.
contextiduint64The 64-bit ID of the context to return assets for.

Returns

The output from this method should be encoded in the JSON format.

Response:
  • result
    • success - True if the method was successful. If the asset server is returning false, it should set error to a string that explains why.
    • error - A string describing why this call failed. This message will be recorded in the error log, which is available under the Economy tab on the Steamworks site.
    • assets - An array of the assets that are children of the specified context.
      • id - The 64-bit ID of the asset.
      • class - An array of game-defined asset class identifiers. It is up to the game to define what
        those identifiers are. They just need to provide enough information to reproduce the asset info
        (i.e. describe what kind of item it is) when the class identifiers are passed back into GetAssetClassInfo/v0001. Each identifier should contain the following fields:
        • name - The name of this part of the class identifier.
        • value - The value of this part of the class identifier as a string.
        • instance - If this is true the class identifier is considered "instance data", which means that it
          generally doesn't transfer with the item on a trade, and so it doesn't factor into the trade value of the item.
          (Default: false)
          NOTE: An asset class property that ultimately has an effect on the market_hash_name of an item in the GetAssetClassInfo/v0001 response should never be considered instance data. The Community Market depends on instance properties not having any effect on the market_hash_name.
        To maximize the amount of description information that Steam can cache, the class identifiers should be as generic and reusable as possible. For example, avoid a class where you just have one property with a name like "itemid" and a value that's the 64-bit ID of the asset. Instead, describe what kind of item it is in a way that gives you enough information to build the description. For example, an asset class of "type" = "sword" and "rarity" = "common" gives you enough information to build the item's description without having to know exactly which instance of the item it is.
      • amount (optional) - The stack count for this asset. The user will be able to trade up to this number of units out of this stack. (Default: 1)
    • currency (optional) - An array of the currency types this context contains. If a user has none of a particular kind of currency it should only be include here if it would be visible on in-game UI. The display of currency is very similar to that of an asset, so the fields listed above for assets also apply to currency, with the exception of the class and id fields. In addition to the other asset fields, the following two fields are used for currency:
      • id - The unsigned 32-bit ID assigned to this kind of currency. This ID must be globally unique within the game.
      • amount - 64-bit integer representing the amount of this kind of currency that is owned by the user.

Example Output

{ "result": { "assets": [ { "id": 131363189, "class": [ { "name": "def_index", "value": "128" }, { "name": "quality", "value": "3" } ] }, { "id": 131412933, "class": [ { "name": "def_index", "value": "155" }, { "name": "quality", "value": "3" } ] }, { "id": 556669733, "class": [ { "name": "def_index", "value": "583" }, { "name": "flags", "value": "1" }, { "name": "origin", "value": "1", "instance": true } ] }, ] , "success": true } }