...What is an API?

So one of my tasks for the past few weeks has been to create an API of some description. So being me, I decided that I wanted to learn something new and make the API at the same time. Which is why I created a python script that has the ability to gather data for Magic: The Gathering cards from a website and parsed that data out to a JSON file. Now that's all well and good, it worked!

But I have no clue how to publish this information anywhere for anyone to use. Which is okay, I guess. Regardless I still looked into what an API is, along this line of research I found that an API is a sort of accessible database that programmers can use in order to ease access to information about an application, game, website etc.

Which is why I came up with the idea of compiling a database of Magic: The Gathering cards. Of course, this has been done before but, like I said, it was a learning opportunity.  Collecting data from a website and parsing that data out to a .json file. All of the card objects contain the data of name, mana cost, rarity, type, description, flavour text and artist, of course this is kind of basic information, but it's enough to make a somewhat cohesive structure of data.

Which is where we come to actually having this data published somewhere in the world wide interwebz for someone to look at and take if they wanted to. So there's two methods that I found that would be relatively appropriate for this. The first would be to make a Node.js module that people can require in their projects, the module would simply give them access to the local database of cards that they got when they downloaded that module OR I can fiddle around with websites and hosting and try to get a ReST API up and out there. 

So naturally I set up a node module, it's easier to do and well, it's easier to do. I've never set up a node module before and so using a couple of resources from the NPM documentation, I was able to spit out the files! that API can be found here and installed with node in the command line. However, this is only a small test project, and I don't really recommend it.


Tylah Kapa