Tag Archives: npr api

ColdFusion NPR API Pt. 2

I’ve dug a little deeper into the NPR API. I’ve added 3 new components. Feed.cfc represents the data returned from the api call. Story.cfc models the actual stories that make up the feed.

The 3rd object is a simple object that I extend to share some common methods to between my other components. I generally consider this bad practice and there are a lot of tools designed specifically to address this problem.

I did it for a couple of reasons. First, I wanted this to self-contained and stand alone. I wanted it to be as easy as possible to drop it into whatever project YOU have, with whatever tools YOU have set up and get it going. Second, I wanted to focus more on the real meat of the product without getting too hung up on the implementation details. Besides, I can always refactor!

Stay Tuned!

Example Usage:


 







	

Download the code!

ColdFusion NPR API Pt. 1

NPR published an API a while back giving easy access to 250,000+ NPR stories.

As I’m still quite the newb when it comes to Object-Oriented Programming I thought I would blog through the process of creating an OO ColdFusion wrapper.

Example Usage:










Download the code!

PS: In order to actually run this you’ll need to register for an account and API key. Also, browse the aggregate to ID mapping info to find yourself some id’s to use!

PPS: A much-love shout-out to my local NPR affiliate WMFE. Support publc radio!