MGBrown.com

Yahoo API update - Now with Term Extraction request

I have updated both the Yahoo API downloads to include support for the Term Extraction request. You can download both the VB.Net and C# zips from here.

The interesting thing about this request it the "context" parameter. As this can be very long it is unlikely to work with a GET request. As a result Yahoo recommend using a POST request instead. This means we need to add some extra code over the usual to make this request work.

VB.Net
...
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
sw = New StreamWriter(request.GetRequestStream())
sw.Write("appid={0}&context={1}&query={2}", appId, context, query)
sw.Close()
...

C#
...
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (StreamWriter sw = new StreamWriter(request.GetRequestStream()))
{
    sw.Write("appid={0}&context={1}&query={2}", appId, context, query);
}
...

Comments

Sorry, this post is no longer accepting comments.