klenium Posted April 14, 2013 Share Posted April 14, 2013 I tried to use backpack.tf api on my website. I want to get the player's backpack value with Javascript. But when I tried to use this simple code in console (Chrome): $.get("http://backpack.tf/api/IGetUsers/v2/?steamids=76561198045802942");then I only got this error message:XMLHttpRequest cannot load http://backpack.tf/api/IGetUsers/v2/?steamids=76561198045802942. Origin http://mywebsite.com is not allowed by Access-Control-Allow-Origin. So, how can I use this api? Do I need an api key, like "IGetPrices"? What did I do wrong? Link to comment Share on other sites More sharing options...
Chief D Posted April 14, 2013 Share Posted April 14, 2013 http://backpack.tf/api/ Link to comment Share on other sites More sharing options...
klenium Posted April 14, 2013 Author Share Posted April 14, 2013 That is a link o: Link to comment Share on other sites More sharing options...
n0:name Posted April 14, 2013 Share Posted April 14, 2013 Origin http://mywebsite.com is not allowed by Access-Control-Allow-Origin. It's already there.... you can't load XML Files from other Websites than your own, it's a security thing. Nothing you can change about it. Link to comment Share on other sites More sharing options...
klenium Posted April 14, 2013 Author Share Posted April 14, 2013 But then why is there this api...? I think, everyone can use it from his website.. If I can't get these informations from my website, then what can I do? There's a search field, if you just want to find someone from this (backpack.tf) site. Link to comment Share on other sites More sharing options...
Chief D Posted April 14, 2013 Share Posted April 14, 2013 That is a link o: Care to click it? Link to comment Share on other sites More sharing options...
Brad Pitt Posted April 15, 2013 Share Posted April 15, 2013 Your server-side script should load that, not the client - it's a browser security feature as the other person above pointed out. Link to comment Share on other sites More sharing options...
klenium Posted April 15, 2013 Author Share Posted April 15, 2013 Ok. I didn't see anything about it on the api's page, so I thought I can use it in browsers. Link to comment Share on other sites More sharing options...
Uranium235 Posted April 16, 2013 Share Posted April 16, 2013 Your server-side script should load that, not the client - it's a browser security feature as the other person above pointed out. Didn't the API, at least v1, support JSONP? Don't remember where I read it, since it's not documented with the API description. But since you need an API Key, I guess that feature is no longer available... Link to comment Share on other sites More sharing options...
Brad Pitt Posted April 16, 2013 Share Posted April 16, 2013 Some of the API functions support jsonp -- but not all of them. Anyway, like I said this should be a server-side request with some caching on your end. If the person refreshes their page on their website every 5 seconds you don't want to hit the backpack.tf server every 5 seconds. Link to comment Share on other sites More sharing options...
klenium Posted July 8, 2013 Author Share Posted July 8, 2013 Again me. What's wrong with the names? backpack.tf/api/IGetPrices/v3/?key=apikey&names=1 This doesn't include the names, only the prices. Link to comment Share on other sites More sharing options...
Brad Pitt Posted July 9, 2013 Share Posted July 9, 2013 Again me. What's wrong with the names? backpack.tf/api/IGetPrices/v3/?key=apikey&names=1 This doesn't include the names, only the prices. Should be ok now, let me know if you notice anything odd. Link to comment Share on other sites More sharing options...
klenium Posted February 18, 2014 Author Share Posted February 18, 2014 Australium weapons aren't in the API. When are you going to add them? Will you add an unique quantity like 1100 for strange uncraftables? And take a look at the alt_defindex. Fire Axe has it, but Bat doesn't. Link to comment Share on other sites More sharing options...
Administrators fisk Posted February 18, 2014 Administrators Share Posted February 18, 2014 Internally, backpack.tf no longer uses item defindexes when storing price data for a few reasons: There are a few items which appear multiple times in the schema (e.g. keys and stock weapons) and this saves on having to remap by defindex Uncraftability and untradability are now stored as separate branches. It's kind of like this: [Kritzkrieg] [6] [Tradable] [Craftable] [Priceindex] <-- used for crate series, unusual effect IDs, etc. 0 otherwise. [0] {price info} [Non-Craftable] [Priceindex] [0] {price info} [11] [...] Ergo we won't have to use numbers like 600 or 1100 any more to signify non-craftability. I will start work on IGetPrices v4 which will use this format so it gets shipped in the next update. Supporting australium stuff should also be simple. Link to comment Share on other sites More sharing options...
Administrators fisk Posted February 18, 2014 Administrators Share Posted February 18, 2014 That was fun. This is what IGetPrices v4 will look like: { "response": { "success": 1, "current_time": 1392752280, "items": { "A Brush with Death": { "defindex": { "0": 30186 }, "prices": { "6": { "Tradable": { "Craftable": { "0": { "currency": "metal", "value": 4, "last_update": 1384656665, "difference": -0.165 } } } } } }, [...] Australium support was simple. It was just commented out of v3 since the API wasn't built for it. I just have to polish this up and make some new documentation, it'll be ready for the upcoming update. Link to comment Share on other sites More sharing options...
klenium Posted April 8, 2014 Author Share Posted April 8, 2014 Bat, kukri, shovel and some other stock weapons haven't included their 2 defindexes yet, unlike others. Why? Could you add all pls? Link to comment Share on other sites More sharing options...
klenium Posted May 5, 2014 Author Share Posted May 5, 2014 Only 4 more missing 0 - 190 - bat 20 - 207 - sticky 5 - 195 - fists 17 - 204 - syringe Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.