Hello, I am university student who has some experience with Java. I’m am new to using APIs and I’m excited to learn how to use this one!
So I’m following the java code same given in Stats Service Record: Arena documentation. So far I’ve successfully importing the required Jar files used in the example The following code: request.setEntity(reqEntity); seems to be giving me an error saying the setEntity method is undefined for the type HttpGet. Whats going on here and how can I solve this?
Also, as a novice to API programming, what’s a good source to start teaching myself these components to make use of this API?
EDIT: I got it working! I guess the sample 343 provides is incorrect? I was missing the request header. follow up question, how would I only request/print out a specific string such as Total Kills or Total Headshots? Thanks!
Thanks for posting this, I was having the same problem with that setEntity line and your fix seems to work perfectly. This is my first foray into API programming as well, so I’m just kind of working through this as I go.
As for your follow-up question, you can use the string that’s being printed by your example and use it to build a JSONObject/JSONArray (depending on hat you’re querying for) and then check specific values from there. I’ve been playing with playlists and here’s a quick example of where I’m at: http://pastebin.com/NMSYHvuL (I request playlists, build a JSONArray from the results, iterate through the array, and print the names of the active playlists)