Jump to content
McKay Development

How to list an item on steam market


Guest Sampli

Recommended Posts

Guest Sampli
function sellItem(item, price, sessionID, callback) {
    var options = {
          url: 'https://steamcommunity.com/market/sellitem/',
          headers: {
              'Accept': '*/*',
              'Origin': 'http://steamcommunity.com',
              'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36 OPR/67.0.3575.130',
              'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
              'Host': 'steamcommunity.com',
              'Origin': 'https://steamcommunity.com',
              'Referer': 'http://steamcommunity.com/profiles/'+client.steamID.getSteamID64()+'/inventory/',
              'Accept-Encoding': 'gzip, deflate, br',
              'Accept-Language': 'en-US,en;q=0.9',
              'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
          },
          form: {
              sessionid: sessionID,
              appid: item.appid,
              contextid: item.contextid,
              assetid: item.assetid,
              amount: 1,
              price: 1
          }
      };

      request(options, function (error, response, body) {
          if(!error && response.statusCode == 200){
              console.log("Item added on market");
          }else{
              console.log(error);
              console.log(body);
              console.log(response);
              console.log(response.statusCode);
          }
      });
}

This is my post request, which throws a http error 400 (bad request) every time. I don't know what i'm doing wrong.

Link to comment
Share on other sites

Guest Sampli
13 minutes ago, vrtgn said:

Try changing the referer to https.

Didn't do anything, sorry.

I ended up figuring it out using the request method.

Link to comment
Share on other sites

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.

Guest
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.

Loading...
×
×
  • Create New...