4 messages in com.googlegroups.google-base-data-apiRe: problem submitting Products items...| From | Sent On | Attachments |
|---|---|---|
| de....@warehouse86.com | 07 Nov 2007 12:07 | |
| Jeff S | 09 Nov 2007 13:01 | |
| Derek Wade | 09 Nov 2007 13:04 | |
| Jeff S | 09 Nov 2007 13:42 |
| Subject: | Re: problem submitting Products items via XML/C# library![]() |
|---|---|
| From: | Jeff S (j....@google.com) |
| Date: | 11/09/2007 01:01:24 PM |
| List: | com.googlegroups.google-base-data-api |
I didn't see anything obvious at a first glance. I was wondering though, what is the dr("String") subroutine that you keep calling? I tried to run your code but wasn't sure what that function was supposed to do.
Thank you,
Jeff
On Nov 7, 12:07 pm, "de....@warehouse86.com" <de....@warehouse86.com> wrote:
I am trying to submit an item to base through the latest C# Library provided (v1.1.1.0) with no luck. I've tried a single item submission and a batch upload (ultimately I want to do batch uploading). I've run the gbase_demo sample program successfully with my developer key and username/password. I've tried replicating the code from there in my own program, but I must still be missing something. I always get an "Invalid Item" return code (400). I don't know if the reason is that there already is an item with the same ID
I've included my program and the XML of the entry trying to be sent. I've included all the required fields, but I always get this reply. I would appreciate any assistance.
Thanks Derek Wade
----------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http:// schemas.google.com/gdata/batch"> <link href="http://www.google.com/base/feeds/items/batch" rel="http://schemas.google.com/g/2005#batch" type="application/atom +xml" /> <link href="http://www.google.com/base/feeds/items" rel="http:// schemas.google.com/g/2005#post" type="application/atom+xml" /> <link href="http://www.google.com/base/feeds/items?start- index=1&max-results=25" rel="self" type="application/atom+xml" /> <link href="http://www.google.com/base/feeds/items" rel="http:// schemas.google.com/g/2005#feed" type="application/atom+xml" /> <batch:operation type="update" /> </feed>
<?xml version="1.0" encoding="utf-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http:// schemas.google.com/gdata/batch"> <g:description type="text" xmlns:g="http://base.google.com/ns/1.0">4 Gymboree Apollo Jeans J Crew Clothes <li> Gymboree Tshirt size 18-24 months <li> Apollo Jeans size 11/12 <li> J Crew shirt size XL</g:description> <g:brand type="text" xmlns:g="http://base.google.com/ns/1.0" /> <g:condition type="text" xmlns:g="http://base.google.com/ns/ 1.0">New</g:condition> <g:isbn type="text" xmlns:g="http://base.google.com/ns/1.0" /> <g:link type="text" xmlns:g="http://base.google.com/ns/1.0">http:// auctions.bargainland.net/detail.aspx?id=81069</g:link> <g:mpn type="text" xmlns:g="http://base.google.com/ns/1.0" /> <g:product_type type="text" xmlns:g="http://base.google.com/ns/ 1.0">jeans</g:product_type> <g:price type="float" xmlns:g="http://base.google.com/ns/1.0">5.75</ g:price> <g:upc type="text" xmlns:g="http://base.google.com/ns/1.0" /> <g:item_type type="text" xmlns:g="http://base.google.com/ns/ 1.0">Products</g:item_type> <g:image_link type="url" xmlns:g="http://base.google.com/ns/ 1.0">http://images.bargainland.net/Capture\thumbnail \88f8d3e7021641afbb3bbb31190f6f40.jpg</g:image_link> <g:expiration_date type="text" xmlns:g="http://base.google.com/ns/ 1.0">2007-11-07T17:02:28.</g:expiration_date> <g:quantity type="int" xmlns:g="http://base.google.com/ns/1.0">1</ g:quantity> <g:weight type="text" xmlns:g="http://base.google.com/ns/1.0">3 pounds</g:weight> <g:location type="location" xmlns:g="http://base.google.com/ns/ 1.0">481 Airport Industrial Dr, Southaven, MS, 38671, USA</g:location> <batch:id>81069</batch:id> <batch:operation type="insert" /> <title type="text">NEW 4 Gymboree Apollo Jeans J Crew Clothes NR</ title> <author> <name>Warehouse86</name> </author> <content type="text">NEW 4 Gymboree Apollo Jeans J Crew Clothes NR</ content> </entry>
VB.NET CODE
--------------------
Dim service As New GBaseService("Google-Tutorial-1.0", "xxxxxxxxxxxxxxxxxxxxxxxxxxxx") service.setUserCredentials("xxxx", "xxxx")
Dim query As GBaseQuery = New GBaseQuery(GBaseUriFactory.Default.ItemsFeedUri) Dim feed As GBaseFeed = service.Query(query) Dim batchFeed As AtomFeed = New AtomFeed(feed)
batchFeed.BatchData = New GDataBatchFeedData batchFeed.BatchData.Type = GDataBatchOperationType.update
Dim entry As New GBaseEntry()
entry.BatchData = New GDataBatchEntryData entry.BatchData.Id =dr("id") entry.BatchData.Type = GDataBatchOperationType.insert
entry.Title.Text = dr("title") entry.Content.Content = dr("Title") 'dr("description") Dim author As New AtomPerson author.Name = "Warehouse86" entry.Authors.Add(author)
entry.GBaseAttributes.AddTextAttribute("description", dr("description")) entry.GBaseAttributes.AddTextAttribute("brand", dr("brand")) entry.GBaseAttributes.AddTextAttribute("condition", dr("condition")) entry.GBaseAttributes.AddTextAttribute("isbn", dr("isbn")) entry.GBaseAttributes.AddTextAttribute("link", dr("link")) entry.GBaseAttributes.AddTextAttribute("mpn", dr("mpn")) entry.GBaseAttributes.AddTextAttribute("product type", "jeans") 'dr("product_type")) entry.GBaseAttributes.AddFloatAttribute("price", dr("price")) entry.GBaseAttributes.AddTextAttribute("upc", dr("upc"))
entry.GBaseAttributes.ItemType = "Products" entry.GBaseAttributes.AddImageLink(dr("Image_link")) entry.GBaseAttributes.AddTextAttribute("expiration date", dr("expiration_date_time")) entry.GBaseAttributes.AddIntAttribute("quantity", dr("quantity")) entry.GBaseAttributes.AddTextAttribute("weight", dr("weight")) entry.GBaseAttributes.Location = dr("Location") batchFeed.Entries.Add(entry) Dim returnFeed As GBaseFeed = service.Batch(batchFeed, New Uri(batchFeed.Batch))
For Each entry As GBaseEntry In returnFeed.Entries If entry.BatchData.Status.Code > 300 Then Label1.Text = "errors encountered" Application.DoEvents() Exit Sub End If Next




