On Oct 2, 4:20 pm, deandail <[EMAIL PROTECTED]> wrote:
> Thanks Eric! Link works great now.
>
> The server's response doesn't give me what I expected. When the
> product is inserted successfully, I get the info that I entered sent
> back to me, with the addition of the created fields like the base id
> and the date/time. However, when the product is not inserted
> successfully, I get no response at all. In the Demo, a response like
> this is returned
>
> 400 Bad Request
> Content-Type: application/xml
> Transfer-Encoding: chunked
> Date: Thu, 02 Oct 2008 23:18:46 GMT
> Expires: Thu, 02 Oct 2008 23:18:46 GMT
> Cache-Control: private, max-age=0
> Server: GFE/1.3
> <errors>
>   <error type="data" field="serving_count" reason="This entry is not
> of type number. Example: 1,000 for one thousand." />
> </errors>

In this case, that _is_ the server's response.
It looks like you may be inserting a null
value for the serving_count attribute.
Perhaps you're leaving that field blank
when hitting submit?


>
> How can I see that response?
>
> Thanks!
> DeAnna
>
> On Oct 2, 3:46 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> > Hi deandail,
>
> > To point the link to your own site the format is:
> > <link rel='alternate' type='text/html' href='http://ENTER-YOUR-URL'/>
>
> > (The important part is the rel='alternate')
>
> > Viewing the response from the Google Base server will
> > depend on how you're submitting the data.  The php4 sample
> > you mentioned uses libcurl, so I would use that to echo the result
> > of the curl_exec():
>
> > $result = curl_exec($ch);  /* Execute the HTTP command. */
> > curl_close($ch);
> > echo '<pre>' . $result . '</pre>';  // result will contain the
> > server's response
>
> > Eric
>
> > On Oct 2, 1:16 pm, deandail <[EMAIL PROTECTED]> wrote:
>
> > > Thanks celebird,
>
> > > Maybe I don't understand how the ftp route works, but I didn't think
> > > it did what I want.
>
> > > Specifically, we have around 18,000 products. Right now, I use a mySQL
> > > query to download that into a csv file, which I upload manually to
> > > Base once a month. There are two problems with that:
>
> > > 1) It takes me a fair amount of time to configure the file correctly,
> > > and future holders of this position likely won't know how to do that.
>
> > > 2) (And the much bigger issue) We sell and receive product every day,
> > > so by the end of the month our Base inventory is sadly out of date. We
> > > see our bounce rates increase steadily over the course of the month as
> > > people more often click on something in Base that we don't actually
> > > have in our online store.
>
> > > 3) (not a problem per se, but to be noted) It takes Base a couple days
> > > to make searchable an upload with several thousand products in it.
>
> > > So I could just upload the spreadsheet more often in order to make it
> > > more accurate, say once a week instead of once a month, and I could
> > > even automate that via FTP. But I don't want our full inventory to be
> > > unsearchable for 2 days out of every week.
>
> > > What I want to do is insert new products and delete products that we
> > > no longer have in stock each day without re-uploading the full
> > > inventory. The insertions and deletes would only total around a dozen
> > > or couple dozen changes a day. My understanding is that the FTP feed
> > > needs to have the same name each time in order for it to be automated,
> > > therefore overwriting the previous file. So if I have a feed where
> > > I've uploaded all 18,000 items, and then I send a subsequent file with
> > > just a few updates, it will overwrite the whole previous file, leaving
> > > me with only those updated items in Base.
>
> > > Do I misunderstand how the ftp process works? Or is some version of
> > > the API system what I need in order to do what I want?
>
> > > If the API is what I need, then here are the answers to your other
> > > questions.
> > > I am right now just doing single item entries until I figure out how
> > > the process works. In the future I will use the batch feature to send
> > > two separate requests: insert new items, delete sold items.
>
> > > The example code I started with can be found 
> > > herehttp://code.google.com/apis/base/samples/php/php-sample.html
>
> > > The two pieces of that sample that I have changed have been the
> > > function to build the insert xml and here is my version of that piece
> > > function buildInsertXML() {
> > > $result = "<?xml version='1.0'?>" . "\n";
> > > $result .= "<entry xmlns='http://www.w3.org/2005/Atom'" . "
> > > xmlns:g='http://base.google.com/ns/1.0'>" . "\n";
> > > $result .= "<category scheme='http://base.google.com/categories/
> > > itemtypes'" . " term='Products'/>" . "\n";
> > > $result .= "<title type='text'>" . $_POST['title'] . "</title>" .
> > > "\n";
> > > $result .= "<g:item_type>Products</g:item_type>" . "\n";
> > > $result .= "<g:price>" . $_POST['price'] . "</g:price>" . "\n";
> > > $result .= "<id>" . $_POST['id'] . "</id>" . "\n";
> > > $result .= "<g:image_link>" . $_POST['image_link'] . "</
> > > g:image_link>" . "\n";
> > > $result .= "<link href='".$_POST['link']."'". "/>" . "\n";
> > > $result .= "<content>" . $_POST['description'] . "</content>" . "\n";
> > > $result .= "</entry>" . "\n";
> > >   return $result;
>
> > > And then I've updated the form where a user manually inputs the
> > > content for those fields, so that I can test and make sure I've got it
> > > all formatted correctly before I switch to a batch setup. That piece
> > > of code I've modified to this
> > > /**
> > >  * Prints a small form allowing the user to insert a new
> > >  * recipe.
> > >  */
> > > function showRecipeInsertPane($token) {
> > >   global $cuisines;
> > >   print '<td valign="top" width="50%">' . "\n";
> > >   print '<table width="100%">' . "\n";
> > >   print '<tr><th colspan="2" style="text-align:center">Insert a new
> > > recipe</th></tr>' . "\n";
> > >   print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' .
> > > "\n";
> > >   print '<input type="hidden" name="action" value="insert">' . "\n";
> > >   print '<input type="hidden" name="token" value="' . $token . '">' .
> > > "\n";
> > >   print '<tr><td align="right">Title:</td>' . "\n";
> > >   print '<td><input type="text" name="title" class="half">' . '</td></
> > > tr>' . "\n";
> > >   print '<tr><td align="right">Type</td>' . "\n";
> > >   print '<td><input type="text" name="product_type" class="half">' .
> > > '</td></tr>' . "\n";
> > >  print '<tr><td align="right">Price</td>' . '<td><input type="number"
> > > name="price">&nbsp;' . '</td></tr>' . "\n";
> > >  print '<tr><td align="right">ID</td>' . '<td><input type="number"
> > > name="id">&nbsp;' . '</td></tr>' . "\n";
> > > print '<tr><td align="right">Image Link</td>' . "\n";
> > > print '<td><input type="text" name="image_link"></td></tr>' .  "\n";
> > >   print '<tr><td align="right">link</td>' . "\n";
> > >   print '<td><input type="text" name="link"></td></tr>' . "\n";
> > >   print '<tr><td align="right">Description</td>' . "\n";
> > >   print '<td><textarea class="full" name="description"></textarea></
> > > td></tr>' . "\n";
> > >   print '<td>&nbsp;</td><td><input type="submit" value="Submit"></
> > > td>' . "\n";
> > >   print '</form></tr></table>' . "\n";
> > >   print '</td>' . "\n";
>
> > > }
>
> > > In the first block, here is the one line that references the link
> > > attribute
> > > $result .= "<link href='".$_POST['link']."'". "/>" . "\n";
> > > and that url is currently being input by hand in the insert form. The
> > > url is accepted, but doesn't attach itself to the item the same way it
> > > does if I enter a link in the csv file. The item isn't linked to our
> > > site.
>
> > > On Oct 2, 11:46 am, Celebird <[EMAIL PROTECTED]> wrote:
>
> > > > the google-base-api isn't needed to upload a feed-file;
> > > > you can simply invoke ftp.
>
> > > > i believe tom's suggestion is not to use the google-base api
> > > > at all, none of it -- so you don't need to deal with details
> > > > like response to requests or creating proper link constructs.
>
> > > > rather, create a tab-delimited-file direct from sql
> > > > and then simply use ftp to upload the file; and with
> > > > google's scheduled-feed feature the ftp step can be
> > > > skipped altogether; so, a tsv, csv, or xml-feed-file
> > > > can be created without the google-base-api.
>
> > > > that said, are you doing direct per-item inserts
> > > > or are you trying to use a batch-operations-feed?
> > > > why is there a form to input a link-attribute?
> > > > exactly which example code is being used?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to