DEV Community

Cover image for New and Fresh Steam API
RenardFute
RenardFute

Posted on

New and Fresh Steam API

A new steam API why ?

I am making this because the actual steam API is quite bad, in fact you neither have a documentation and the community market access.

Why in java ?

Mainly because this is my favorite language but also because you can do almost everything from android apps to desktop apps and many others.

Add it to your project

This is in java so you can add it to any java project using maven or gradle.

Maven:

<dependency>
  <groupId>fr.renardfute</groupId>
  <artifactId>SteamAPI</artifactId>
  <version>1.0</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode

Gradle:

implementation 'fr.renardfute:SteamAPI:1.0'
Enter fullscreen mode Exit fullscreen mode

How to start ?

I though this api could be used with multiple account at the same time so you can initialize multiple instances of it.

Step n°1

Initialize an api instance:

SteamAPI api = new SteamAPI("YOUR_STEAM_LOGIN_SECURE_COOKIE");
Enter fullscreen mode Exit fullscreen mode

Here you will have to give a steamLoginSecure cookie because steam needs it for many request. I plan to add a steam login thing to disable the hard codding of this cookie.

Step n°2

Use it.
Now that you have the api instatialized you can use it as you want.
In the v1.0 you can do:

  • Get apps infos (price, ranking, screenshots, player count and much more)
  • Get item market infos (price, history, picture)
How to get an app ?
  • By it's name :
SteamAPI api = new SteamAPI("YOUR_STEAM_LOGIN_SECURE_COOKIE");
List<App> apps = api.searchApp("Rust");
App rust = apps.get(0);
Enter fullscreen mode Exit fullscreen mode

In this exemple I getted rust by only knowing it's name.
But you may ask "why apps.get(0)". And this is for two reason the first is that there is not only one game that is called rust so .searchApp("") will return a list of game that match that name and the second is that .searchApp("") order the app list by their player count so rust is obviously most played game which is called rust.

  • By it's id:
SteamAPI api = new SteamAPI("YOUR_STEAM_LOGIN_SECURE_COOKIE");
App rust = api.getApp(252490);
Enter fullscreen mode Exit fullscreen mode

Here I putted 252490 because it's the rust steam app id. You can find them by going on the steam page of a game and it will be in the url.
A screen capture to show where is the app id

How to get an item ?

There is actually two ways of getting an item:

SteamAPI api = new SteamAPI("YOUR_STEAM_LOGIN_SECURE_COOKIE");
App rust = api.getApp(252490);
Item blackoutHelmet = rust.getItem("Blackout Helmet", Currency.USD, api);
Enter fullscreen mode Exit fullscreen mode
SteamAPI api = new SteamAPI("YOUR_STEAM_LOGIN_SECURE_COOKIE");
App rust = api.getApp(252490);
Item blackoutHelmet = new Item("Blackout Helmet", rust, api, Currency.USD);
Enter fullscreen mode Exit fullscreen mode

In the two cases I gave the item name here "Blackout Helmet", the app here rust, and api object (for requesting steam) and a currency.

Actually there is only two available currency USD and EUR but I will add others in next updates.

End

I hope you will like this api and this post. Let me know in the comments if you have ideas or things to change. I am waiting for your returns ^^.

Oldest comments (0)