SteamCardExchange.net is a service that allows its users to safely exchange their Steam Trading Cards for virtual currency and vice versa. This repository contains the source code for an unofficial REST API server. It relies on web scraping and allows you to easily access such data as the number of cards in stock, how much currency you can get from turning them in and how much they cost to buy.
- Clone the repository;
- From the root directory of the cloned repository, run
pnpm install
to install the dependencies (you can also use NPM or Yarn); - Run
pnpm build
to transpile the code; - Run
pnpm start
to start the server.
By default, the server starts on port 8002
. If the aforementioned port is taken by another process, it will exit with an error. You can configure it to use another port (e.g. 8003
) in one of two ways:
- Set the environment variable by hand:
PORT=8003 pnpm start
; - Copy existing "
.env.template
" file into ".env
", change the contents toPORT=8003
and then executepnpm start
.
Send GET
requests to http://127.0.0.1:8002/apps/570
, where:
127.0.0.1
is the IP address of your server (leave it as is if it's hosted locally);8002
is the port that you configured (leave it as is if you didn't configure anything);570
is the ID of a game on Steam that you're interested in.
You can get game IDs from the URIs of their store pages. E.g, Dota 2 (URI: https://store.steampowered.com/app/570/Dota_2
) has ID 570
which is used in this example.
Here's an example of how the responce may look:
[
{ "name": "Bounty Hunter", "amount": 1, "worth": 5, "price": 8 },
{ "name": "Phantom Lancer", "amount": 4, "worth": 5, "price": 5 },
{ "name": "Razor", "amount": 7, "worth": 5, "price": 5 },
{ "name": "Riki", "amount": 0, "worth": 5 },
{ "name": "Tidehunter", "amount": 8, "price": 5 },
{ "name": "Tiny", "amount": 1, "worth": 5, "price": 8 },
{ "name": "Tusk", "amount": 8, "price": 5 },
{ "name": "Vengeful Spirit", "amount": 8, "price": 5 }
]
Response explanation:
Property | Possible values | Meaning |
---|---|---|
name | Any string | The title of the card |
amount | Any integer | The number of cards that SteamCardExchange holds |
worth | Any integer | How much credits you get for turning this card in. Property doesn't exist if you can't turn the card in |
price | Any integer | How much credits getting the card will cost you. Property doesn't exist if you can't buy this card |