Aug 17, 2011

9:30 AM

Digg API updated with Newswire

Written by Dave Beckett • Filed under Company

APIs are sexy, sexy things and we've updated the Digg API to get support for the new coolness of the Digg Newswire.

Lots of people use the Digg web API every day and we've added some new features. Read on for the details!

Newswire API

We have added a new API for retrieving Newswire story lists. The new API call story.getNewswireNews can be used to get the same lists of stories that you can get on the website, including the filters for topic, maximum and minimum Diggs.

The story list response can be turned into a feed using the standard parameter &type=rss which generates an Atom 1.0 feed.

Example: You are looking for the hot news on obamacare or the tea party from around the web to Digg so you'll want the politics topic and a request like:

Maybe that's too noisy with the default maximum and minimum Digg values (1 and ∞) so adjust the ranges with the min_diggs and max_digg parameters:

The other parameters are described in the story.getNewswireNews.

Feed format improvements and Unicode fixes

Any API request to Digg that returns a story list can be returned in one of three formats: JSON (the default), XML or a feed format using the type query parameter to the request. An example that gets the Top News story list as JSON would be with the story.getTopNews request like:

To get the feed version, add the ?type=rss query parameter like:

We have upgraded this response to now generate the standardized and valid Atom 1.0 feeds instead of the previous format. Validity was checked with the site.

In addition, the output feed markup is now legal Unicode encoded in UTF-8.

Finally, none of that ‘Smart Quote’ shit makes it through.


We fixed the API to deal with some of the weird requests we get and to return more error responses rather than 503 errors, which usually indicate code problems.

The HTTP response from the APIs now properly indicate cacheability of the response. This was measured using Mark Nottingham's redbot which is super useful and you should check it out. As a bonus for reading this far, let me note here that currently the newswire API response is not cached, you get the same live response as we serve on the site.

Documentation improvements

As well as the changes above we also made several fixes and corrections to the documentation of the Digg API such as properly describing the arguments allowed and their legal values. You can see a summary of these such as time windows in the Arguments reference

As always, please let us know any comments or bugs you find. You can give us a shout over on the newly reactivated @diggapi Twitter account with your feedback and questions.