Exploring the Marvel API


Found out from Product Hunt that Marvel has a developer API. I don’t think of myself as a comic book nerd, but lately I’ve realized that… I may actuall be a comic book nerd.

I never owned or purchased a ton of comics as a kid. I still have a very small pile of comics at my parents’ house in Indianapolis, but I was never someone who actively sought them out. Still, I managed to read or become familiar with almost all of the major superheroes out there – I know their origin stories, and know enough about most of them to handle a decent conversation.

I got an iPad as a gift a few years ago, and with the Marvel app… I’ve read a ton of comics. I’m a little more caught up on recent events, but it’s a small vice that I’ll succumb to now and then (just recently signed up for Marvel Unlimited, so there’s less spending and more binging in my future).

So on hearing there was a Marvel API to mess around with, I got excited. I’m not sure exactly what I might want to do, but right now it’s more of an exploratory thing.

On requesting my API keys, it took a few hours before the online/interactive documentation worked for me. Just an FYI there.

I’ve since been able to make a few successful calls, but nothing really beyond basic queries. So far, the interesting things seem to be images of each character and textual summaries of certain “events” in the Marvel universe.

At a glance, some of the data seems sparse – but this might just be because I haven’t dug deep enough. Right now it feels like there’s a skeleton/structure in place, but it doesn’t quite seem “rich” yet. Again, this might be because I haven’t poked around enough yet.


I’m enjoying the discovery process so far. The above image is housed at this URL (whose domain name is http://i.annihil.us/). Bonus points to you if you recognize that name.

Late in the evening, I happened across a big list of Marvel characters, and figured out a good way to extract data from this page. Doing a quick check, I found that the IDs used in the URL strings seemed to be the “official” IDs for each character… so I decided to scrape some of the content from this page.

Using some regex fun, I was able to create this bit of JSON data: http://pastebin.com/SHCgFCVd. I think Justin would be proud of me, for that bit of regex work.

I like having that character data available on the side, as there’s a rate limit of 3000 for the Marvel developer API. There’s not a good way to grab a Marvel character at random, so perhaps this JSON data will allow for that (and save an API call).

Still not sure yet what I want to do, and mostly just noodling around at the moment. If you want to grab a semi-functional working version of things, check out this repo (and replace the process.env.MARVEL_KEY_PUBLIC/PRIVATE vars with your own API keys).

One of the big challenges I still seem to have is figuring out how to bind Node with actual pages. I haven’t delved much into Express, but I have a hunch this is my next step.

Related:
Receiving a Card and Stickers from Product Hunt
Joss Whedon’s Astonishing X-Men Comics
Love from (and for) Wordnik
Flickr API Searches and Improving Accuracy
Exploring the Echo Nest API

This Post Has 0 Comments

Leave A Reply