Jump to content
McKay Development

Parse getTradeOffer json items_to_receive and add those items to a new trade


Recommended Posts


I was using steam web api to get information about a trade, and I want my bot to be able to check what items the user would be receiving, and make a new trade with those same items.

I have the code to parse the items to be received, but I am not sure how I would separate each item and create a new trade offer with the information.

var url = "http://api.steampowered.com/IEconService/GetTradeOffer/v1/?" + "key=redacted" +"&tradeofferid=3844057934"

              url: url,
              json: true
            }, function (error, response, body) {
            if (!error && response.statusCode === 200) {


Any help is appreciated!

Edited by Dr. McKay
Removed API key
Link to comment
Share on other sites

Here is my updated code!

var tradeItems = [];

fetch("http://api.steampowered.com/IEconService/GetTradeOffer/v1/?" + "key=XXXXXX" + "&tradeofferid="+tradeID)
        .then(response => response.json())
        .then(tradeInfo => {
          for(var i = 0; i < tradeInfo.response.offer.items_to_give.length; i++){
            var array = tradeInfo.response.offer.items_to_give[i]

it uses node-fetch

Edited by Sampli
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...