2 messages in com.googlegroups.google-base-data-apiRe: C# noob needs help!!!!
FromSent OnAttachments
sighman16 Sep 2007 11:36 
Jeff S25 Sep 2007 11:32 
Subject:Re: C# noob needs help!!!!
From:Jeff S (j.@google.com)
Date:09/25/2007 11:32:28 AM
List:com.googlegroups.google-base-data-api

Hello Simon,

Your query seems to be a good start. I compared it to the example code on the developer's guide here:
http://code.google.com/apis/base/csharpdevguide.html#query and I wrote out a sample code snippet which I think you will be able to cut and paste. You just need to substitute your API key.

GBaseService service = new GBaseService(".NET query test", "ABRIABAA...g"); GBaseQuery query = new GBaseQuery(GBaseUriFactory.Default.SnippetsFeedUri); query.GoogleBaseQuery = "[item type:products]"; GBaseFeed feed = service.Query(query); foreach(GBaseEntry entry in feed.Entries) { Console.WriteLine("Entry title: " + entry.Title.Text); Console.WriteLine(entry.GBaseAttributes.ItemType);

Console.WriteLine(entry.GBaseAttributes.GetAttributes("price") [0].Content); }

The last WriteLine call shows how to get any of the Google Base item attributes (including any custom attributes), for this example I happened to used the price attribute.

For a "digital camera" query, you likely get a list of products because those are the results deemed most relevant for that particular query. A query for something like "chicken tacos" would likely have different item types in the results :)

The sub-type for a product is stored in the <g:product_type> element which you can get using the .NET library like this:

entry.GBaseAttributes.GetTextAttribute("product type");

Hope this isn't too late for your deadline,

Jeff

On Sep 16, 11:36 am, sighman <afir@gmail.com> wrote:

HI there,

I'm trying to query google base using keywords and product types, I can get results from a query using keywords, but not an attribute type query. I get a parse error??? but nothing specific about whats wrong.

Is this right : query.GoogleBaseQuery = "[item type: recipes]";

What am i doing wrong?

And why do I get "products" back always as item type when I do a key word query? I query "digital camera" for example and all I get is "products"? I want to know what kind of product type this digital camera is, like for example consumer electronics etc... you know what I mean right? Is that even possible?

Any way if someone can pleeaaaasse demystify this for me a bit. Got a huge deadline and need this to start working some what.

Thanks