Some code for card APIs

This is post is for the 8 teams of CMPT 225 students working on a Phylogame app.  Note that there is apparently a small error in this script (we’ll get Enej to take a look when he gets back from vacation).
Cheers
Dave
**************************************************************************************
*  API DOCS v0.5
**************************************************************************************
URL API Parameters:
api – can eather be json or xml default is json, has to be present
num – returns the number of cards maximum is 200 default is 20
page – page number to get to the page = 2 for second page
callback – only applicable to json will call the callback function with the json data passed into it.
if you don’t have a callback parameter specified phylomon_cards will be returned with with the data inside it.
diy – set this parameter to get back the diy cards instead
URL that will work.
Urls you can visit.
homepage:
cards:
diy-cards:
single card url:
Example urls:
http://phylogame.org/?api=json&num=200&page=2 // – gets 200 cards on the second page as a json_object
same example HTML
<script>
function get_cards(data) {
alert(‘The first card is ‘+data[0].name );
console.log( data[0] );
}
</script>
<script src=”http://phylogame.org/?api=json&callback=get_cards”></script>
<!– <script src=”http://phylogame.org/2013/04/evening-grosbeak/?api=1&callback=get_cards”></script> –>
*/

Leave a Reply

Your email address will not be published. Required fields are marked *