【问题标题】:Google Merchant Product Feed with multiple items per XML file?每个 XML 文件包含多个商品的 Google Merchant Product Feed?
【发布时间】:2011-08-23 04:24:07
【问题描述】:

问题

是否可以在 XML 产品 Feed 中向 Google Merchant 提交超过 1 件商品?

到目前为止我所拥有的

我在谷歌文档中找到了一个singleData 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>

我在追求什么

我期待类似的东西;

<?xml version='1.0'?>
<entries>
    <entry xmlns="http://www.w3.org/2005/Atom" [...] >
        [...]
    </entry>
    <entry xmlns="http://www.w3.org/2005/Atom" [...] >
        [...]
    </entry>
</entries>

特别是因为 XML 并不意味着有超过 1 个根元素。

我的研究

我有;

到目前为止都没有成功。

【问题讨论】:

    标签: xml


    【解决方案1】:

    Google 提供了两种不同的方式来管理提交到其购物平台(又名:Google Base)的商品。最初的问题似乎是两种不同方法的混合:


    Google Merchant Center 供稿

    这些是原始 XML 文件,其中包含要添加到 Google Base 的一系列项目。

    documentation here 展示了如何创建包含多个项目的 XML 文件(单击“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>
    

    使用correct attributes 创建此文件后,您必须使用upload it to Google's servers

    此方法的好处:您可以使用与TheFind's service 相同的 XML 文件。


    购物内容 API

    此 API 使用 XML 作为对 Google API 进行插入/更新/删除的单个调用的主体。 XML 属性(在原始问题中链接为“Data Item”)与Merchant Center Feed attributes 略有不同。

    使用此 API,您一次只能与 Google 讨论一个项目,这就是原始问题中的“条目”示例正确的地方:

    <?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>
    

    这将用作API call to Google 的主体,例如用于插入新项目:

    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>
    

    此方法的好处:您可以对每件商品进行精细控制,并且可以针对每件商品进行插入/删除/更新,而不是为了一个小改动而编辑整个 Merchant Center Feed XML 文件。

    【讨论】:

      猜你喜欢
      • 2015-06-07
      • 1970-01-01
      • 2014-09-09
      • 1970-01-01
      • 2016-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多