yoda302055 Posted May 5, 2013 Report Posted May 5, 2013 Hi guys i have been programming for a few years now... I still haven't been able to work with different languages. But now that i am actually driven. I would love it if someone could provide an example and explain how an API works. i have looked over the internet and stuff and i still don't understand how they work.Anyways, My goal for this to work with my Login application. Comparing what the user has entered to the Data Base. Any help would be appreciated. Thanks in advance everybody .
iBotPeaches Posted May 5, 2013 Report Posted May 5, 2013 You make an API like you make anything else. It interprets responses it gets and outputs data. The slight difference is there is no interface and the returned data is usually JSON/XML. EX: Hittingstats/members Would hit the database, then return the json file containing Members, xx etc. As you get more powerful, you begin to add basic things to output on each API request. EX, time of request, status of request, incoming API version, etc. Look at this API: https://stats.svc.halowaypoint.com/english/players/iBotPeaches%20v5/h4/servicerecord You hit that, and get data. Raw data. You then interpret on your application (ex http://leafapp.co) and make something beautiful. 2
yoda302055 Posted May 6, 2013 Author Report Posted May 6, 2013 (edited) So the thing that I dont understand is how does it convert API?job=value to a function? Edited May 6, 2013 by yoda302055
iBotPeaches Posted May 6, 2013 Report Posted May 6, 2013 So the thing that I dont understand is how does it convert API?job=value to a function? You just parse it as it comes in, like regular user input. EX in php $what_to_do = $_POST['action']; switch ($what_to_do) { case "login": $this->login; break; case "foo": $this->foo; break; } print json_encode(array(''));
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now