I tried but I got "invalid item" as well
Here's my code:
GBaseQuery query = new GBaseQuery
(ConfigurationFactory.Instance.GoogleBaseBaseURI);
GBaseService service = new GBaseService("MyMarket data
transfer", ConfigurationFactory.Instance.GoogleBaseAPIKey);
service.setUserCredentials(
ConfigurationFactory.Instance.GoogleBaseUsername,
ConfigurationFactory.Instance.GoogleBasePassword);
GBaseFeed feed = service.Query(query);
AtomFeed batchFeed = new AtomFeed(feed);
batchFeed.BatchData = new GDataBatchFeedData();
batchFeed.BatchData.Type =
GDataBatchOperationType.update;
GBaseEntry entry;
AtomPerson author;
entry = new GBaseEntry();
author = new AtomPerson();
entry.Authors.Add(author);
entry.BatchData = new GDataBatchEntryData();
entry.BatchData.Id = productEntity.ProductID.ToString
();
//entry//.Id=new AtomId(
productEntity.OptimisticLocalization = true;
author.Name = "MyMarket.ch";
//entry.Id = productEntity.ProductID.ToString();
entry.Title.Text = productEntity.LocalizedName;
entry.Content.Content =
productEntity.LocalizedDescription;
entry.GBaseAttributes.ItemType = "Products";
entry.GBaseAttributes.Price = new FloatUnit((float)
productEntity.UnitCost, "CHF");
entry.GBaseAttributes.ImageLinks = imageUrl.Split
(",".ToCharArray());
if(productEntity.BrandId.HasValue)
{
entry.GBaseAttributes.AddTextAttribute("brand",
productEntity.Brand.Name);
}
entry.Language = "de";
entry.BatchData.Type = GDataBatchOperationType.insert;
batchFeed.Entries.Add(entry);
GBaseFeed returnFeed = service.Batch(batchFeed, new Uri
(batchFeed.Batch)) as GBaseFeed;
foreach(var myentry in returnFeed.Entries)
{
if(myentry.BatchData.Status.Code>300)
{
throw new ApplicationException("Not inserted
product");
}
}
Paolo
valuieOn Mar 23, 4:26 pm, Drew Lewis <[email protected]> wrote:
> Try products with a capital P.
>
> On Mon, Mar 23, 2009 at 10:55 AM, paolo883 <[email protected]>
> wrote:
>
> > Hi,
>
> > I'm trying to upload to Google Base the whole catalog of our online
> > shop using C# code (based on your demo) but I'm having success only if
> > I use
>
> > entry.GBaseAttributes.ItemType = "testrecipies";
>
> > If I use
>
> > entry.GBaseAttributes.ItemType = "products";
>
> > I get a 400 Status Code ("invalid item")
>
> > Another question: How can I check if a product was already inserted
> > with the same entry.BatchData.Id value?
>
> > Thanks a lot
>
> > Paolo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---