This topic has been locked
Yiemorx Jul 17, 2015 @ 5:11am
Steam Inventory API
Hey all! im working on a website for my clan. i have made a successful steam login and im able to get the json file from this link http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/ and convert it into usable php code. but how can i get the weapon names, images and how much the weapon is worth i cant see anything in this json file on name, images and the price i want to get the inventory data from CSGO.

Thanks and sorry for my bad english.
< >
Showing 1-15 of 47 comments
MalikQayum Jul 17, 2015 @ 6:51am 
well basically there 2 ways of doing this if i remember correctly, first being:
get the player items through the getplayeritems call then get the defindex and make a call to the getschema then you want to get the prices and you would need to use the getassetsclassinfo call.. so thats 1 way of doing it..

but how i would do it is just get the json from the 730 inventory from the player then use the getassetclassinfo, now do not ask me to write u the code this should be sufficient information to get u to where u want to go.
Yiemorx Jul 17, 2015 @ 7:09am 
No need for code example man im very capable of using google :) but thank you very much this was extreamly helpful and i beleave i have already found out how to use it and implement it thanks alot man!
MalikQayum Jul 17, 2015 @ 7:38am 
Originally posted by ShadowDragon:
No need for code example man im very capable of using google :) but thank you very much this was extreamly helpful and i beleave i have already found out how to use it and implement it thanks alot man!
np bro just out of curiousity which way did u use ?
Mr.Pang Jul 17, 2015 @ 7:39am 
...
Yiemorx Jul 17, 2015 @ 7:34pm 
Originally posted by Salman Khan Bajrangi Bhaijaan:
Originally posted by ShadowDragon:
No need for code example man im very capable of using google :) but thank you very much this was extreamly helpful and i beleave i have already found out how to use it and implement it thanks alot man!
np bro just out of curiousity which way did u use ?


Ok sorry for my late reply i went to bed after about 2 hours of messing around. Anyway what i found was these 2 links the first one i have added my own data into it so if you want to view it add your own steam API key
http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?key=AAAAA&appid=730&class_count=1&classid0=1131459905

and i can get the class id for that first link using this link i had already in my code.

http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/?key=AAAAAA&steamid=AAAAAAA

The only problem i have now is im not to sure how i can make a loop to get all the IDs for the GetPlayerItems link and then replace it with the GetAssetClassInfo link and im also not sure how to use the image URLs the first link gives me

For example i get this.
"icon_url_large": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXQ9Q1LO5kNoBhSQl-fSPSoxc7HWlJ6GlJopbOpPQJy7P_JYzpHoojkwNXak_GmYuzTl2gIuJMn372Y9o2hjgXl-ENqZjr3cISdc1I-aV7Oug_ps8v273w",

how am i ment to get a image link with a bunch of random letters and numbers?

Anyway after i while i ended up finding Node Steam but i have never ever used JS script in my HTML befor let alone in PHP so i got stuck there and gave up. So i am still in need of some help here.

Sorry for my bad english.
MalikQayum Jul 18, 2015 @ 3:13pm 
and i apologize for my late responce aswell, the thing is u return is coming back in a json format so u simply get the information u want from the json now this is pseudo code but for php it would be something like:
not so much pseudo but as i havent look at the json u are looking at but i guess if modified this example it should work.

$url = "http://api.steampowered.com/.........."; $json_content = file_get_contents($url); $json = json_decode($json_content, true); //then u want to get the information u want from the json echo $json->icon_url_large; // or do something else with it.
Last edited by MalikQayum; Jul 18, 2015 @ 3:18pm
Yiemorx Jul 19, 2015 @ 3:18am 
Hey that is what i have been doing i just got a little confused with something. How ever i have found a new link that gives me the inventory json of a player iv tryed a forloop but its not working
$inventory = file_get_contents("http://steamcommunity.com/profiles/".$steamprofile['steamid']."/inventory/json/730/2"); $myarray = json_decode($inventory, true); foreach($myarray['success']['rgInventory'] as $item) { echo $item['classid']; }
Last edited by Yiemorx; Jul 19, 2015 @ 3:19am
Yiemorx Jul 19, 2015 @ 4:27am 
Originally posted by Salman Khan Bajrangi Bhaijaan:
and i apologize for my late responce aswell, the thing is u return is coming back in a json format so u simply get the information u want from the json now this is pseudo code but for php it would be something like:
not so much pseudo but as i havent look at the json u are looking at but i guess if modified this example it should work.

$url = "http://api.steampowered.com/.........."; $json_content = file_get_contents($url); $json = json_decode($json_content, true); //then u want to get the information u want from the json echo $json->icon_url_large; // or do something else with it.

Ok so i have this now but it gives me only parts of the name as in the first letter of each any ideas?

$inventory = file_get_contents("http://steamcommunity.com/profiles/".$steamprofile['steamid']."/inventory/json/730/2"); $myarrayInv = json_decode($inventory, true); foreach($myarrayInv['rgInventory'] as $item) { $GetItem = file_get_contents("http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?key=XXXXX&appid=730&class_count=1&classid0=".$item['classid']); $myarrayGetInv = json_decode($GetItem, true); foreach($myarrayGetInv['result'][$item['classid']] as $item_A) { echo @$item_A['name']; ?> <br> <?php } ?> <br> <?php }
Last edited by Yiemorx; Jul 19, 2015 @ 4:30am
♂DON JABRON♂ Jul 19, 2015 @ 5:09am 
.
N7_Wargar_fr Jul 19, 2015 @ 5:12am 
:)
MalikQayum Jul 19, 2015 @ 10:02am 
if u are using the json from the inventory itself 730/2 u should probably just get the rgDescriptions rather than rgInventory as that contain more data..

also i do not know why you do not get the full name probably because i have not bothered testing it and i probably wont, but u got this far so a bit more testing for urself with some trial and error and i am sure u gonna get it, so GL :P
Yiemorx Jul 19, 2015 @ 11:15pm 
Yeah trial and error hahaha i spent 4 hours on this and i finaly got everything to work so thank you Salman for your help :)
Kasih Rusak Jul 19, 2015 @ 11:17pm 
nice
Yiemorx Jul 19, 2015 @ 11:18pm 
Originally posted by Zzzzzz:
nice
:) Basicly i pulled a stupid and was running 2 foreach loops in each other which was only giving me the first letter of every items name haha
< >
Showing 1-15 of 47 comments
Per page: 1530 50

Date Posted: Jul 17, 2015 @ 5:11am
Posts: 47