JOEZACK.COM Code Musings and Such

30Sep/080

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:

<cfset your_key = "Go get one from http://www.npr.org/templates/reg/"/>
 
<!--- create the object --->
<cfset npr_interface = CreateObject("component","npr").init(
	key = your_key
)/>
 
<!--- pass you some ids --->
<cfset result = npr_interface.Get(
	id = "1059,1008"
)/>
 
<!--- voila --->
<cfdump var="#result#">

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!

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.