Google Merchant Product Feed with multiple items per XML file?
The Question
Is it possible to submit more than 1 item in an XML Product Feed to Google Merchant?
What I have so far
I have found an example in the Google Docs of a single "Data Item":
<?xml version='1.0'?>
<entry xmlns="http://www.w3.org/2005/Atom" [...] >
<app:control>
<sc:required_destination dest="ProductSearch"/>
</app:开发者_开发技巧control>
<title>Wool sweater</title>
[...]
</entry>
What I'm after
I was expecting something like;
<?xml version='1.0'?>
<entries>
<entry xmlns="http://www.w3.org/2005/Atom" [...] >
[...]
</entry>
<entry xmlns="http://www.w3.org/2005/Atom" [...] >
[...]
</entry>
</entries>
Especially since XML is not meant to have more than 1 root element.
My Research
I have;
- read the Merchant Center Help
- read Google's Content API for Shopping docs
- searched on Google
- searched on SO
all so far without success.
Google provides two separate ways for managing items submitted to their Shopping platform (aka: Google Base). The original question appears to be a mix of the two different approaches:
Google Merchant Center Feeds
These are raw XML files which contain a series of items to be added to Google Base.
The documentation here shows how to create an XML file with multiple items (Click "Feed Creation Issues" > "Atom 1.0"):
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
<title>The name of your data feed.</title>
[...]
<entry>
<title>Red wool sweater</title>
[...]
</entry>
<entry>
<title>Blue bow</title>
[...]
</entry>
</feed>
Once this file is created with the correct attributes, you must upload it to Google's servers.
Bonus of this method: You can use the same XML file with TheFind's service.
Content API for Shopping
This API uses XML as the body of a single call to Google's API for insertion / update / deletion. The XML attributes (linked to as "Data Item" in the original question) are slightly different than the Merchant Center Feed attributes.
Using this API, you can only talk to Google about a single item at a time, which is where the 'entry' example in the original question is correct:
<?xml version='1.0'?>
<entry xmlns="http://www.w3.org/2005/Atom" [...] >
<app:control>
<sc:required_destination dest="ProductSearch"/>
</app:control>
<title>Wool sweater</title>
[...]
</entry>
This would be used as the body of an API call to Google, such as for inserting a new item:
POST https://content.googleapis.com/content/v1/YOUR_MERCHANT_ID/items/products/schema
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=CLIENTLOGIN_TOKEN
<?xml version='1.0'?>
<entry xmlns="http://www.w3.org/2005/Atom" [...] >
[...]
</entry>
Bonus of this method: You have fine grained control over every item and can insert / delete / update on a per-item basis rather than editing your entire Merchant Center Feed XML file for one small change.
精彩评论