XML 架構

本節說明商家評論資料動態饋給使用的 XML 結構定義。

頂層元素:<feed>

說明

最上層的容器元素,用於存放動態消息中的所有其他元素。

屬性

名稱 格式 發生次數 說明
xmlns xs:string 必要 (1) 請將下列值硬式編碼:
http://schemas.google.com/merchant_reviews/5.0
xmlns:xsi xs:string 必要 (1) 請將下列值硬式編碼:
http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation xs:string 必要 (1) 請將下列值硬式編碼,並在網址之間保留一個半形空格
http://schemas.google.com/merchant_reviews/5.0 http://www.gstatic.com/productsearch/static/reviews/5.0/merchant_reviews.xsd

範例

<feed xmlns="http://schemas.google.com/merchant_reviews/5.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schemas.google.com/merchant_reviews/5.0 https://www.gstatic.com/productsearch/static/reviews/5.0/merchant_reviews.xsd">

包含

名稱 格式 發生次數 說明
merchants       -- 選填 (0 到 1) <merchant> 元素的容器元素。
deleted_merchants       -- 選填 (0 到 1) <deleted_merchant> 元素的容器元素。
reviews       -- 選填 (0 到 1) <review> 元素的容器元素。
deleted_reviews       -- 選填 (0 到 1) <deleted_review> 元素的容器元素。

<merchants>

說明

<merchant> 元素的容器。

包含

名稱 格式 發生次數 說明
merchant       -- 必要 (1‑n) 每個商家都會重複這個元素。

<merchant>

說明

每個 <merchant> 元素都包含一位商家的資訊和評論。

屬性

名稱 格式 發生次數 說明
id ID 必要 (1) 所有動態饋給的 ID 都不得重複,且必須保持不變。換句話說,如果今天的動態饋給和 90 天前的動態饋給參照的是同一位商家,則兩者必須具有相同的 ID。

範例

<merchant id="2739">

包含

請在商家元素中加入下列元素。

名稱 格式 發生次數 說明
name NonEmptyString 必要 (1) 商家可讀的顯示名稱。
merchant_url xs:anyURI 必要 (1) 商家主要網站的網址。
請勿使用這個值的重新導向網址。換句話說,這個值應直接指向商家的網站。

範例如下:

<merchant_url>
  http://store.google.com
</merchant_url>

rating_url xs:anyURI 必要 (1) 這個商家評論的到達網頁網址。
請勿使用重新導向網址。

範例如下:

<rating_url>
  http://merchant_url.com/reviews/
</rating_url>

create_timestamp DateTimeWithTimeZone 必要 (1) 商家建立時間/日期。這個屬性值一律不得變更。
last_update_timestamp DateTimeWithTimeZone 必要 (1) 商家上次更新的時間/日期。如果特定商家 ID 的 <merchant> 元素中有任何欄位更新,這個值也必須變更。

<deleted_merchants>

說明

已刪除商家的容器。

包含

名稱 格式 發生次數 說明
deleted_merchant       -- 必要 (1‑n) 包含與單一已刪除商家相關的元素。

<deleted_merchant>

說明

已刪除的商家。

屬性

名稱 格式 發生次數 說明
id ID 必要 (1) 指定應從動態饋給中刪除的商家 ID。ID 必須與先前任何動態饋給檔案中 <merchant> 元素的 id 屬性相符。

包含

名稱 格式 發生次數 說明
last_update_timestamp DateTimeWithTimeZone 必要 (1) 商家從系統中移除的時間/日期。

範例如下:

<last_update_timestamp>
  2016-04-03T18:37:32Z
</last_update_timestamp>

範例

<deleted_merchant id="10">
  <last_update_timestamp>2014-07-12T07:55:06Z</last_update_timestamp>
</deleted_merchant>

<reviews>

說明

<review> 元素的容器。

包含

名稱 格式 發生次數 說明
review       -- 必要 (1‑n) 每個評論都會重複這個元素。

<review>

說明

包含評論相關詳細資料的容器。

屬性

名稱 格式 發生次數 說明
id ID 必要 (1) 系統中的評論 ID。所有動態饋給的 ID 不得重複,且必須保持不變。

範例:

<review id=132739 mid=1234>

mid ID 必要 (1) 這則評論所屬商家的 ID。

包含

請在評論元素中加入下列元素。

名稱 格式 發生次數 說明
reviewer_name NonEmptyString 選用 (0 到 1) 評論作者的顯示名稱,前提是評論應有具名的作者。 匿名評論不應包含這個欄位。

範例如下:

<reviewer_name>
  Joel
</reviewer_name>

create_timestamp DateTimeWithTimeZone 必要 (1) 使用者提交評論的時間/日期。這個屬性值一律不得變更。

範例如下:

<create_timestamp>
  2016-04-03T18:37:32Z
</create_timestamp>

last_update_timestamp DateTimeWithTimeZone 必要 (1) <review> 元素中的資訊上次變更的時間/日期。如果特定評論 ID 的 <review> 元素中有任何欄位更新,這個值也必須變更。

範例如下:

<last_update_timestamp>
  2016-04-03T18:37:32Z
</last_update_timestamp>

country_code CountryCode 必要 (1) 評論者的國家/地區。如適用,這是指產品的運送目標國家/地區,或是提供服務的目標國家/地區。否則,請使用評論者建立評論時所在的國家/地區。國家/地區代碼必須採用 ISO 3166-1 alpha-2 格式。

範例如下:

  <country_code>
    US
  </country_code>

title xs:string 選用 (0 到 1) 評論的標題。標題應為純文字,不得包含任何 HTML 標記。

範例如下:

  <title>
    Great prices
  </title>

content xs:string 必要 (1) 評論內容。這應是使用者提供的任意格式文字,且不應截斷。內容應為純文字,不得包含任何 HTML 標記。舉例來說,換行符號應以換行字元表示,而非 <br> 標記。如果提供不同問題的多個回覆,請一併附上所有回覆,並提供最少量的背景資訊,確保回覆內容有意義。如果問題未獲解答,請勿提供背景資訊。

範例如下:

  <content>
    I like this store!
    My order arrived on time and I got
    a great price.
  </content>

範例如下:

  <content>
    Positives: Great prices.
    Suggestions: Selection could be better.
  </content>
ratings           -- 必要 (1) 審查人員對商家評分的容器元素。如果 <overall> 元素沒有評等,則應從動態饋給中排除整個相關聯的評論,因為 <overall> 元素為必要元素,缺少此元素將無法接受評論。
collection_method CollectionMethodType 必要 (1) 收集評論的方法。這個值必須是下列其中一個:
  • 主動評論:使用者提交評論時,並非回覆特定邀請。
  • point_of_sale:使用者下單時獲得邀請,並提交評論。
  • after_fulfillment:使用者收到產品後,獲得邀請才提交評論。

範例如下:

  <collection_method>
    after_fulfillment
  </collection_method>

<ratings>

說明

包含評論者對商家的評分。如果 <overall> 元素沒有評等,則應從動態饋給中排除整個相關聯的評論,因為 <overall> 元素為必要元素,缺少此元素將無法接受評論。

包含

請在評分元素中加入下列元素。

名稱 格式 發生次數 說明
overall RatingRange 必要 (1) 評論者對商家的整體評分。

範例如下:

  <overall min="1" max="10">9</overall>

customer_service RatingRange 選用 (0 到 1) 評論者對這個商家客戶服務品質的評分。

範例如下:

  <customer_service min="1" max="5">3</customer_service>

<deleted_reviews>

說明

已刪除評論的容器。

包含

名稱 格式 發生次數 說明
deleted_review       -- 必要 (1‑n) 包含與單一已刪除評論相關的元素。

<deleted_review>

說明

已刪除的評論。

屬性

名稱 格式 發生次數 說明
id ID 必要 (1) 指定應從動態饋給中刪除的評論 ID。ID 必須與任何動態饋給檔案中 <review> 元素的 ID 屬性相符。

包含

名稱 格式 發生次數 說明
last_update_timestamp DateTimeWithTimeZone 必要 (1) 評論從系統中移除的時間。

範例:

  <last_update_timestamp>
    2016-04-03T18:37:32Z
  </last_update_timestamp>

範例

<deleted_review id="10">
  <last_update_timestamp>2014-07-12T07:55:06Z<last_update_timestamp>
</deleted_review>