Post by Charles Stover on Apr 27, 2012 15:25:01 GMT -8
I've had this up for a while now, but have yet to really do anything with it. I was going to wait for V5's release to make an arcade (which I still plan on doing), but... that's been going on forever.
If anyone wants to check it out, it's a flash games API that lets you load the games from Gaming Medley (Free hotlinking for everyone! Woohoo!).
List of parameters and descriptions:
api.gamingmedley.com/?tutorial
Example query:
api.gamingmedley.com/?compact&format=json&get=icon,id,title&handler=arcade.load&limit=16&sort=created
Example use:
api.gamingmedley.com/?compact&format=json&get=icon,id,title&handler=arcade.load&limit=16&sort=created
Outputs:
for (var x = 0; x < 16; x++)
document.write('<a href="mypage.php?game=' + games[x].id + '" title="' + games[x].title + '"><img src="http://www.gamingmedley.com/' + games[x].id + '.' + games[x].icon + '" width="100" height="100" alt="' + games[x].title + '" /><\/a>');
mypage.php?game=whatever
api.gamingmedley.com/?compact&format=json&get=height,title,width&handler=arcade.game&id=whatever
Outputs:
document.write('<embed etc src="http://www.gamingmedley.com/' + games[0].id + '" width="' + games[0].width + '" height="' + games[0].height + '"><\/embed>');
And of course you can do this without JavaScript by retrieving the data server side (file_get_contents("API URL") + json_decode), which also supports format=xml for your pleasure, and format=php if you happen to be on a server that lets you include external files.
Any critiques, suggestions, etc. Let me know. The images and SWF files are meant to be hotlinked. That's the purpose of the API, so don't worry about hotlinks and such.
I do recommend you cache data (in an array in JavaScript, or in a file in PHP) if there are going to be multiple queries, obviously. If you don't know how, don't worry about it.
If anyone wants to check it out, it's a flash games API that lets you load the games from Gaming Medley (Free hotlinking for everyone! Woohoo!).
List of parameters and descriptions:
api.gamingmedley.com/?tutorial
Example query:
api.gamingmedley.com/?compact&format=json&get=icon,id,title&handler=arcade.load&limit=16&sort=created
Example use:
api.gamingmedley.com/?compact&format=json&get=icon,id,title&handler=arcade.load&limit=16&sort=created
Outputs:
for (var x = 0; x < 16; x++)
document.write('<a href="mypage.php?game=' + games[x].id + '" title="' + games[x].title + '"><img src="http://www.gamingmedley.com/' + games[x].id + '.' + games[x].icon + '" width="100" height="100" alt="' + games[x].title + '" /><\/a>');
mypage.php?game=whatever
api.gamingmedley.com/?compact&format=json&get=height,title,width&handler=arcade.game&id=whatever
Outputs:
document.write('<embed etc src="http://www.gamingmedley.com/' + games[0].id + '" width="' + games[0].width + '" height="' + games[0].height + '"><\/embed>');
And of course you can do this without JavaScript by retrieving the data server side (file_get_contents("API URL") + json_decode), which also supports format=xml for your pleasure, and format=php if you happen to be on a server that lets you include external files.
Any critiques, suggestions, etc. Let me know. The images and SWF files are meant to be hotlinked. That's the purpose of the API, so don't worry about hotlinks and such.
I do recommend you cache data (in an array in JavaScript, or in a file in PHP) if there are going to be multiple queries, obviously. If you don't know how, don't worry about it.