There were some requests on the AIR Daily maillist for a quick&dirty how-to on using NPR’s new API. Your most common use will probably be embedding a single story into your web page or blog post.
Find the story at NPR.org, then grab the url, e.g. this recent HV piece:
Now paste all the above into your page/post, and it’ll display like this:
To display more than one story, list each ID, separated by a comma; e.g., the ID’s of these recent Jack Chance encounters: http://www.npr.org/templates/story/story.php?storyId=89723386 http://www.npr.org/templates/story/story.php?storyId=88961745 used in this code:
Notice I’ve specified the
fields=title,teaser,storyDate,show,audio. Those fields determine what’ll show on the page: you can remove some, or add others. The list of what’s possible is under the FIELDS tab of NPR’s Query Generator.
While there, check out the many other possibilities for interacting with NPR database of stories, audio, text, and photos. You can specify search terms, NPR shows, topics, and a host of other criteria for creating custom lists. And you can see how the lists will display. If there’s demand I’ll add another how-to sometime on using the Query Generator. (UPDATE: QG how-to added.)
Click the upper-left Register link to start your account. Or, if you subscribe to an NPR newsletter, you already have an account: click instead the upper-left Login link and enter your NPR subscription email and password.
Once in, click the Manage link in the upper-left. Copy it. (You can get it again anytime by returning to your account settings, and using the Open API top tab.)
Update: also see post for NPR API Query Generator.