Using the digg API in an ASP.NET Page
Posted by andy gaskell on Apr 20th, 2007
Digg released their API yesterday - I haven’t really done much with RESTful web services because in the .net world, most of the time SOAP/WSDL is used. I thought a very basic RESTful web service project would be useful for other .net developers.
This example gets a list of all topics that digg offers. The code is pretty simple:
// Create the web request, change the appkey to for your applications
HttpWebRequest request = WebRequest.Create("http://services.digg.com/topics?appkey=http%3A%2F%2Fgaskell.org") as HttpWebRequest;
// won't get a response from digg if UserAgent is not set
request.UserAgent = ".net";
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
DataSet ds = new DataSet();
ds.ReadXml(reader);
this.topicsGridView.DataSource = ds.Tables[1];
this.topicsGridView.DataBind();
}
August 3rd, 2007 at 4:11 pm
a good tut. i reviewed two .net lib for digg api - u may have a look here: http://virtual-view.blogspot.com/2007/08/net-library-for-digg-api-making-it-work_03.html