What’s an API?
An API is a service that a computer can talk to, in order to get information about a certain topic, or to operate another program remotely.
Why would you need an API for Magic: The Gathering?
If you wanted to write a mobile app which displays information about MtG cards, you either need to load all of that data (about 10MB) into your app and update it every 3 months, or use some service to provide it all, ad-hoc. There is an official site called Gatherer, which displays information about any card you want, but computers can’t read it — it’s meant for people.
What are the options?
I’ve been working on my own card API for a little while now, but today I’ve discovered quite a few other interesting services. Since I’m in the market of filling an unfilled role, I don’t have any special competitive spirit for my own product, so here’s a rundown of what you can use:
This is my product. I just released the v1.1 beta [view the super cool and funny* release notes]. It’s open source, so anyone can use, modify, and host their own. It lets you search for a card by name, and returns data structured in JSON. The returned data is in a simpler structure than the other services here. (*Lie)
Update: I now host a pretty version of magic-api called Scry (http://scry.me.uk)
Example query: Hopeful Eidolon on magic-api
StC has a pretty website! It queries magiccards.info instead of Gatherer and allows you to search by property instead of just individual card names. The return data is just right. It’s really quite good!
Example query: Hopeful Eidolon on Search the City
Also, it supposedly shares a JSON format with the MTG JSON project…
This isn’t actually an API; it’s an up-to-date database of all cards, in JSON. Could be a useful fallback if you need your application to work offline.
This is another standard API that does what it says on the tin. It returns JSON but doesn’t set the content-type header (at time of writing), which is annoying.
Example query: Hopeful Eidolon on mtgapi
Hope you have fun developing or learning!