通訊協定指南

傳統版 Google Sites API 可讓您的應用程式存取、發布及修改 Google 網站中的內容。 此外,應用程式也可以要求最近活動清單、擷取修訂版本記錄,以及上傳/下載附件和檔案。

適用對象

本文假設您已瞭解 Google Data API 通訊協定背後的一般概念。

本文件可協助程式設計人員編寫可與 Google 協作平台互動的用戶端應用程式。提供一系列使用原始 XML/HTTP 的基本資料 API 互動範例和說明。閱讀本文件後,您可以閱讀左側導覽列中其他指南中的特定語言範例,進一步瞭解如何使用用戶端程式庫與 API 互動。

如要查看本指南所含內容,請參閱參考指南

授權要求

當應用程式要求非公開的使用者資料時,當中必須包含授權權杖。這個權杖也可讓 Google 識別您的應用程式。

關於授權通訊協定

您的應用程式必須使用 OAuth 2.0 對要求進行授權,系統不支援其他授權通訊協定。如果您的應用程式採用使用 Google 帳戶登入功能,系統會為您處理部分授權事項。

使用 OAuth 2.0 對要求進行授權

向 Google Sites Data API 發出的非公開使用者資料要求都必須獲得已驗證使用者的授權。

OAuth 2.0 授權程序 (或「流程」) 的細節會根據您編寫的應用程式類型而有所不同。下列一般程序適用於所有應用程式類型:

  1. 建立應用程式後,請透過 Google API 控制台註冊應用程式。接著 Google 會向您提供稍後需要的資訊,例如用戶端 ID 和用戶端密碼。
  2. 在 Google API 控制台中啟用 Google Sites Data API。(如果 API 控制台裡沒有列出該 API,則可略過這個步驟)。
  3. 當應用程式需要存取使用者資料時,會向 Google 要求特定的存取範圍
  4. Google 會向使用者顯示同意畫面,請對方授權您的應用程式要求部分資料。
  5. 如果使用者同意,Google 即會授予短期存取權杖給您的應用程式。
  6. 您的應用程式向使用者要求資料,並且在要求中附上存取權杖。
  7. 如果 Google 判定您的要求與權杖有效,便會傳回您要求的資料。

部分流程包含額外步驟,例如使用「更新權杖」來取得新的存取權杖。如要進一步瞭解各類應用程式的流程,請參閱 Google 的 OAuth 2.0 說明文件

以下是 Google Sites Data API 的 OAuth 2.0 範圍資訊:

https://sites.google.com/feeds/

如要透過 OAuth 2.0 要求存取權,您的應用程式需要範圍資訊,以及 Google 在您註冊應用程式時提供的資訊 (例如用戶端 ID 和用戶端密碼)。

返回頁首

指定版本

凡是傳送至 Google Sites Data API 的要求,都必須指定 1.4 版本。如要指定版本號碼,請使用 GData-Version HTTP 標頭:

GData-Version: 1.4

或者,如果您無法設定 HTTP 標頭,則可在網址中指定 v=1.4 做為查詢參數。但盡可能使用 HTTP 標頭。

注意:用戶端程式庫會自動提供適當的版本標頭,因此當您使用用戶端程式庫時,請勿使用 v=1.4 查詢參數。

返回頁首

網站動態消息

網站動態消息可用來列出使用者擁有的 Google 協作平台、具備檢視權限,也可以修改現有網站的標題。如果是 G Suite 網域,這類網址也可以用來建立或複製整個網站。

列出網站

如要列出使用者可存取的網站,請將通過驗證的 GET 要求傳送至下列網址:

https://sites.google.com/feeds/site/domainName
動態饋給參數說明
domainNamesite」或您 G Suite 代管網域的網域 (例如 example.com)。

回應會包含內含網站清單的動態饋給:

GET /feeds/site/domainName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/site/site</id>
<updated>2009-12-02T17:47:34.406Z</updated>
<title>Site</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/site/site"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/feeds/site/domainName"/>
<link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName"/>
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/?start-index=2"/>
<generator version="1" uri="http://sites.google.com/">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;CkUAQH4_eil7I2A9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/site/myTestSite</id>
  <updated>2009-12-01T01:17:21.042Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T01:17:21.042Z</app:edited>
  <title>myTestSite</title>
  <summary/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myTestSite/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <sites:siteName>myTestSite</sites:siteName>
  <sites:theme>default</sites:theme>
</entry>
<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Memories Site"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <sites:siteName>myOtherTestSite</sites:siteName>
  <sites:theme>iceberg</sites:theme>
</entry>
...
</feed>

網站會依字母順序列出。

建立新網站

注意:這項功能僅適用於 G Suite 網域。

向網站動態饋給發出 HTTP POST 即可佈建新網站,例如:

POST /feeds/site/example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <title>Source Site</title>
  <summary>A new site to hold memories</summary>
  <sites:theme>slate</sites:theme>
</entry>

上述要求會在 G Suite 網域 example.com 下建立採用「石板」主題的新 Google 網站。 該網站的網址會是 http://sites.google.com/a/example.com/source-site/。

如果成功建立網站,伺服器會回應 201 Created。 回應項目將包含伺服器新增的元素,例如網站連結、網站 ACL 動態饋給的連結、網站名稱、標題和摘要。

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>New Test Site</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <sites:siteName>source-site</sites:siteName>
  <sites:theme>slate</sites:theme>
</entry>

複製網站

注意:這項功能僅適用於 G Suite 網域。

您可以複製現有網站,方法與建立新網站相同。不過,在 POST 要求的 Atom 項目中,加入 <link>,其中包含 rel='source' 指向要複製的網站動態消息。完成複製的所有網站都會提供這個連結以下是複製網站的範例:

POST /feeds/site/example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom">
  <link rel="http://schemas.google.com/sites/2008#source" type="application/atom+xml"
      href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <title>Copy of New Test Site</title>
  <summary>A newer site to hold memories</summary>
</entry>

上述要求會複製位於 http://sites.google.com/a/example.com/source-site/ 的網站。

重要事項:

  • 您只能複製已驗證使用者擁有的網站和網站範本。
  • 您也可以複製網站範本。如果 Google 協作平台設定頁面中的「將這個網站發布為範本」設定處於勾選狀態,即視為範本。
  • 你可以從其他網域複製網站,對方待你在來源網站上列為擁有者。

更新網站中繼資料

如要更新網站的標題或摘要,請將 HTTP PUT 傳送至網站項目的 edit 連結。舉例來說,以下範例會將舊網站的標題更新為 New Test Site2,說明則為 Newer description

PUT /feeds/site/example.com/source-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>New Test Site2</title>
  <summary>Newer description</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Category"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <sites:siteName>source-site</sites:siteName>
</entry>

新增類別

注意:這項功能僅適用於 G Suite 網域。

您網域的 G Suite 網站包含類別中繼資料,適合用來分類網域中的網站。如要新增或更新類別中繼資料,請將 HTTP PUT 傳送至你網站項目的 edit 連結 (包含 category 標記)。請參閱以下範例中的粗體程式碼:

PUT /feeds/site/example.com/source-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>My Team website</title>
  <summary>This site contains contact information and a summary of major efforts our team owns</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <sites:siteName>my-team-site</sites:siteName>
</entry>

這個範例會編輯現有的網站並新增「團隊網站」類別。

如要新增多個類別,您也可以新增其他 <category> 標記。請參閱以下範例中的粗體程式碼:

PUT /feeds/site/example.com/my-team-site HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
    gd:etag="W/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/my-team-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>My Team website</title>
  <summary>This site contains contact information and a summary of major efforts our team owns</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site/">
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Legal Department/">
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/>
  <sites:siteName>my-team-site</sites:siteName>
</entry>

這個範例新增兩個類別:「團隊網站」和「法務部門」

網址對應

網址對應可讓協作平台使用者將自己的網域對應至 Google 協作平台。例如,您可以使用 http://www.mydomainsite.com 取代 http://sites.google.com/a/domain.com/mysite。視網站的代管位置而定,您可以手動修改網站的網址對應。詳情請參閱我們的說明中心文章。

擷取網站的網址對應

如要傳回網站的網址對應,請使用 with-mappings=true 參數擷取網站項目/動態饋給:

GET /feeds/site/domainName?with-mappings=true HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
...
<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='http://www.mysitemapping.com'>
  <link rel='webAddressMapping' href='http://www.mysitemapping2.com'>
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>
...
</feed>

現有的對應關係會顯示為 link,當中包含 rel='webAddressMapping'。舉例來說,在上述範例中,有三個 webAddressMapping 指向網站 http://sites.google.com/site/myOtherTestSite

修改網址對應

注意:所有 GET/POST/PUT 作業都應該在使用網址對應時指定 with-mappings=true 參數。如果缺少這項參數,系統就不會在網站項目 (GET) 中傳回 webAddressMapping,也不會在更新/移除項目 (PUT) 對應時考量這些項目。

如要新增、更新或刪除對應關係,只要在建立新網站更新網站中繼資料時指定、變更或移除這類連結即可。網站動態饋給 URI 必須包含 with-mappings=true 參數。注意:您必須是網站管理員或網域管理員 (使用 G Suite 代管網站),才能更新地址對應。

例如,下方要求會將 http://www.mysitemapping.com 對應更新為 http://www.my-new-sitemapping.com,而將 http://www.mysitemapping2.com 從項目中移出,藉此移除 http://www.mysitemapping2.com

PUT /feeds/site/domainName?with-mappings=true HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='www.my-new-sitemapping.com'>
  <!-- missing mapping2 will be deleted -->
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>

請注意,您也可以在建立/複製網站時指定網址對應。

返回頁首

活動動態消息

您可以擷取活動動態消息,擷取網站的近期活動 (變更)。活動動態饋給中的每個項目都包含對網站所做的變更資訊。

如要查詢活動動態消息,請將 HTTP GET 傳送至活動動態消息網址:

https://sites.google.com/feeds/activity/domainName/siteName
動態饋給參數說明
domainNamesite」或您 G Suite 代管網域的網域 (例如 example.com)。
siteName網站的網頁空間名稱,您可以在網站的網址中找到 (例如 myCoolSite)。

要求與回應範例:

GET /feeds/activity/site/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">
<id>https://sites.google.com/feeds/activity/site/siteName</id>
<updated>2009-09-10T05:24:23.120Z</updated>
<title>Activity</title>
<link rel="alternate" type="text/html" href="http://sites.google.com/site/siteName/system/app/pages/recentChanges"/>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName"/>
<link rel="self" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU4GQ3szfSl7ImA9WxNRFUg.&quot;">
<id>https://sites.google.com/feeds/activity/site/siteName/940375996952876062</id>
<updated>2009-09-10T03:38:42.585Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#deletion" label="deletion"/>
<title>home</title>
<summary type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">User deleted <a href="http://sites.google.com/site/siteName/home">home</a>
</div>
</summary>
<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
  href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
<link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
  href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
<link rel="self" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName/940375996952876062"/>
<author>
  <name>User</name>
  <email>user@gmail.com</email>
</author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8DQn45fyl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/7165439066235480082</id>
  <updated>2009-09-10T03:37:53.027Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#edit" label="edit"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User2 edited <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/7165439066235480082"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8AR3s4cSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/127448462987345884</id>
  <updated>2009-09-10T03:37:26.539Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#creation" label="creation"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User3 created <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/127448462987345884"/>
  <author>
    <name>User3</name>
    <email>user3@gmail.com</email>
  </author>
</entry>
</feed>

注意:你必須是網站的協作者或擁有者,才能存取這個動態饋給。 用戶端必須傳送正確的 Authorization 標頭,並參照在授權要求中取得的權杖。

返回頁首

修訂版本動態饋給

如要擷取任何內容項目的修訂版本記錄,請將 HTTP GET 傳送至該項目的修訂版本連結:

https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
動態饋給參數說明
domainNamesite」或您 G Suite 代管網域的網域 (例如 example.com)。
siteName網站的網頁空間名稱,您可以在網站的網址中找到 (例如 myCoolSite)。

如要找出特定頁面/註解/附件/清單項目的修訂版本連結,請先使用內容動態饋給中的 CONTENT_ENTRY_ID 擷取項目。擷取的項目會包含修訂版本動態饋給的 <atom:link>。例如:

<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>

要求與回應範例:

GET /feeds/revision/domainName/siteName/CONTENT_ENTRY_ID HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID</id>
<updated>2009-09-10T04:33:35.337Z</updated>
<title>Revisions</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;CU4GQmA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2</id>
  <updated>2009-09-10T03:38:42.045Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Latest content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4f67c7&amp;rev1=2"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>2</sites:revision>
</entry>
<entry gd:etag="W/&quot;CU8DQ388eSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1</id>
  <updated>2009-09-10T03:37:52.171Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Older content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4bc7&amp;rev1=1"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>1</sites:revision>
</entry>
</feed>

注意:你必須是網站的協作者或擁有者,才能存取這個動態饋給。 您的用戶端必須傳送正確的 Authorization 標頭,並參照在授權要求中取得的權杖。

返回頁首

內容動態消息

擷取內容

內容動態饋給會列出協作平台目前的內容。將通過驗證的 GET 要求傳送至下列網址:

https://sites.google.com/feeds/content/domainName/siteName
動態饋給參數說明
domainNamesite」或您 G Suite 代管網域的網域 (例如 example.com)。
siteName網站的網頁空間名稱,您可以在網站的網址中找到 (例如 myCoolSite)。

進而產生一個列出網站第一頁內容項目的動態饋給。動態饋給中的每個項目都代表不同類型的內容項目,例如 webpagefilecabinetattachmentcomment 等。<category scheme="http://schemas.google.com/g/2005#kind"> 元素會決定項目的類型。如需支援 kind 值的清單,請參閱參考指南

注意:這個動態饋給不一定需要驗證,實際情況視網站的共用權限而定。 如果網站非公開,您的用戶端必須傳送正確的 Authorization 標頭 (如上例所示),並參照在授權要求中取得的權杖。

GET /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
  xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
  xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
  xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/domainName/siteName</id>
<updated>2009-08-31T01:39:20.286Z</updated>
<title>Content</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/domainName/siteName/batch""/>
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry gd:etag="W/&quot;Ck8GQXk7fil7ImA9WxNSFk0.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/7322156894</id>
  <updated>2009-08-30T02:53:40.706Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:53:40.706Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Subpage</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div>
  </content>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/6492205817"/>
  <link rel="alternate" type="text"
      href="http://sites.google.com/site/siteName/subpage"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/7322156894"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>subpage</sites:pageName>
  <sites:revision>5</sites:revision>
</entry>
<entry gd:etag="W/&quot;CkMBQH08fCl7ImA9WxNSFk0.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/5930635231</id>
  <updated>2009-08-30T02:47:31.374Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:47:31.374Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#listitem" label="listpage"/>
  <title/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/5930635231"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:revision>1</sites:revision>
  <gs:field index="A" name="Issue/Feature">Implement cool feature X</gs:field>
  <gs:field index="B" name="Priority">P2</gs:field>
  <gs:field index="C" name="Owner"/>
  <gs:field index="D" name="Resolved"/>
</entry>
<entry gd:etag="W/&quot;AkYHQ3ozcCl7ImA9WxJaE08.&quot;">
  <id>https://sites.google.com/feeds/content/domainName/siteName/1265948545471894517</id>
  <updated>2009-08-03T19:35:32.488Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-03T19:35:32.488Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>files</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div>
  </content>
  <link rel="alternate" type="text"
      href="https://sites.google.com/domainName/siteName/files"/>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
      href="https://sites.google.com/feeds/revision/domainName/siteName/12671894517"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <gd:feedLink href="httpn://sites.google.com/feeds/content/domainName/siteName?parent=12671894517"/>
  <sites:pageName>files</sites:pageName>
  <sites:revision>1</sites:revision>
</entry>
...
</feed>

注意:這裡只會顯示前幾項結果。如要逐頁瀏覽整個內容動態消息,請依循該動態饋給的「下一步」連結:

<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>

如需 Atom 常見元素的說明,請參閱 Google Data 通訊協定參考資料。 以下會說明保留傳統版協作平台 API 特定狀態的元素。某些種類項目會有額外的屬性 (未列出的屬性),而其他屬性則不會。例如,listitem 項目可能包含 <gs:field> 元素,而 webpage 項目則否。

元素說明
<content ...>內部文字是網頁的 HTML 內文。針對部分項目 (例如附件),這個元素會包含指向檔案的 src 屬性。
<link rel="alternate" ...>連結至 Google 協作平台中的網頁或項目。
<link rel="http://schemas.google.com/sites/2008#revision" ...>href 屬性指向項目的修訂版本動態饋給。
<link rel="http://schemas.google.com/sites/2008#parent" ...>href 屬性指向該項目的父項項目。
<link rel="http://schemas.google.com/sites/2008#template" ...>href 屬性會指向項目的範本頁面。
<category scheme="http://schemas.google.com/g/2005#kind" ...>label 是項目類型。
<category term="http://schemas.google.com/g/2005#template" ...>label=template,表示該項目為範本。
<gd:feedLink>href 屬性指向項目父項的子項。
<sites:pageName>網頁的網頁空間名稱,與網頁網址中的名稱對應。
<sites:revision>目前的修訂版本編號。

內容動態饋給查詢範例

您可以使用部分標準 Google Data API 查詢參數和傳統版 Sites API,來搜尋內容動態饋給。如要瞭解詳情及完整的支援參數清單,請參閱參考指南

擷取特定項目種類

如果只要擷取特定類型的項目,請使用 kind 參數。這個範例只會傳回 webpage 個項目:

GET /feeds/content/domainName/siteName?kind=webpage

如要傳回多個項目類型,請使用「,」分隔每個 kind。這個範例會傳回 filecabinetlistpage 項目:

GET /feeds/content/domainName/siteName?kind=filecabinet,listpage

或者,您也可以採用 Google 資料 /-/category 查詢 (而非 kind 參數) 的標準格式:

GET /feeds/content/domainName/siteName/-/filecabinet|listpage

擷取頁面範本

以下範例只會傳回 template 網頁:

GET /feeds/content/domainName/siteName/-/template

如要傳回所有項目類型並納入 template 頁面,請使用:

GET /feeds/content/domainName/siteName/-/template|-template

依路徑擷取頁面

如果您知道 Google 網站內網頁的相對路徑,可以使用 path 參數擷取該網頁。 以下範例會傳回位於 http://sites.google.com/site/siteName/path/to/the/page 的網頁:

GET /feeds/content/domainName/siteName?path=/path/to/the/page

擷取上層頁面下的所有項目

如果您知道網頁的項目 ID,可以使用 parent 參數擷取其所有子項目 (如果有的話):

GET /feeds/content/domainName/siteName?parent=CONTENT_ENTRY_ID

包含草稿或已刪除的項目

如要納入草稿或已刪除的項目,請分別使用 include-draftsinclude-deleted 參數。以下範例包含內容動態饋給中的草稿項目:

GET /feeds/content/domainName/siteName?include-drafts=true

全文搜尋

如要搜尋網站的所有內容,請使用 q 參數執行全文搜尋:

GET /feeds/content/domainName/siteName?q=Text%20I%20am%20looking%20for

返回頁首



建立內容

您可將 HTTP POST 傳送至內容動態饋給,藉此建立新的內容 (網頁、清單頁面、檔案櫃頁面、公告頁面等):

https://sites.google.com/feeds/content/domainName/siteName

如需支援的項目類型清單,請參閱參考指南中的 kind 參數。

建立新項目 / 頁面

以下範例會在 Site 的頂層中建立新的 webpage、包括網頁內文的 XHTML,並將標題標題設為「New WebPage Title」:

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 328
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>New Webpage Title</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div>
  </content>
</entry>

如果成功,伺服器會回應 201 Created 和項目副本。

在「自訂網址路徑」中建立項目/網頁

根據預設,先前的範例會在 http://sites.google.com/domainName/siteName/new-webpage-title 網址下建立,並將頁面標題設為「New Web Title」(新網頁標題)。也就是說,網址的 <atom:title> 會正規化為 new-webpage-title。如要自訂網頁網址路徑,請設定 <sites:pageName> 元素。

本例會建立含有「File Storage」頁面標題的新 filecabinet,但指定 <sites:pageName> 元素,在網址 http://sites.google.com/domainName/siteName/files 之下建立頁面。

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 393
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>File Storage</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">A list of files is below.</div>
  </content>
  <sites:pageName>files</sites:pageName>
</entry>

伺服器會使用下列優先順序規則為網頁的網址路徑命名:

  1. <sites:pageName> (如果有的話)。必須符合 a-z, A-Z, 0-9, -, _ 的規定。
  2. <atom:title>,如果 pageName 不存在,則不得為空值。正規化會將空白字元截斷至「-」,並移除不符合 a-z, A-Z, 0-9, -, _ 的字元。

舉例來說,伺服器可接受「Custom_Page2」。

建立子頁面

如要在父項頁面底下建立子頁面 (子項),請在新的 Atom 項目中加入 <link rel="http://schemas.google.com/sites/2008#parent">。將連結的 href 屬性設為父項項目的自我連結。

此範例會在父項公告頁面 (項目 ID 為 PARENT_ENTRY_ID) 下方,建立標題為「announcement」的新 announcement。網頁內文的 XHTML 內容也包含在內:

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 470
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#announcement" label="announcement"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
      href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  <title>announcement</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div>
  </content>
</entry>

頁面範本

建立頁面範本

建立頁面範本的程序與建立新項目/網頁建立子頁面相同,差別在於 category 會新增字詞,並將字詞和標籤設為「http://schemas.google.com/g/2005#template」和「template」。

本範例會建立新的 webpage 範本。

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 464
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <category scheme="http://schemas.google.com/g/2005#labels" term="http://schemas.google.com/g/2005#template" label="template"/>
  <title>Webpage Template</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div>
  </content>
</entry>

使用範本建立頁面

與建立頁面範本類似,您可以加入 <link>,並在其中加入指向頁面範本自我連結的 rel='http://schemas.google.com/sites/2008#template',透過範本將新頁面執行個體化。

本例使用現有的頁面範本 (定義檔案櫃) 建立新的 filecabinet 頁面。

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 464
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/>
  <title>File Cabinet Page From Template</title>
  <link rel='http://schemas.google.com/sites/2008#template' type='application/atom+xml'
    href='https://sites.google.com/feeds/content/domainName/siteName/ENTRY_ID'/>
</entry>

注意:儘管範本會定義 <category>,但您仍需要在項目中加入一個範本。此外,如果您納入 <content> 元素,伺服器會拒絕該元素。

正在上傳檔案

如同 Google 協作平台,這個 API 可讓您將附件上傳至檔案櫃頁面和上層頁面。

如要上傳附件給父項,請傳送 HTTP POST 要求至內容動態饋給網址:

https://sites.google.com/feeds/content/domainName/siteName

POST 主體應為 MIME 多部分要求,以便合併檔案內容與包含附件中繼資料的 <atom:entry><atom:entry> 應參照父項項目的自我連結,以便指定連結建立位置。詳情請參閱「建立子頁面」。

正在上傳附件

以下示範如何將 PDF 檔案上傳至 ID 為 PARENT_ENTRY_ID 的檔案櫃。建立附件時,標題為「PDF 檔案」,並加上說明 (選填) 的「HR 封包」說明。

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 7221984
Content-Type: multipart/related; boundary=END_OF_PART
--END_OF_PART
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
          term="http://schemas.google.com/sites/2008#attachment" label="attachment"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  <title>PDF File</title>
  <summary>HR packet</summary>
</entry>

--END_OF_PART
Content-Type: application/pdf

... pdf contents here ...

--END_OF_PART--

如果上傳成功,伺服器會傳回 201 Created 和新建附件項目的副本。

將附件上傳至資料夾

如要將附件上傳至 filecabinet 中現有的資料夾,請加入類別,並將「term」屬性設為資料夾名稱:

<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">

網路附件

網路附件是一種特殊的附件。基本上,這些檔案會連結至網路上的其他檔案,方便您新增至檔案櫃清單。這項功能類似於 Google 協作平台使用者介面中的「透過網址新增檔案」上傳方法。

注意:網路附件只能在檔案櫃頁面中建立。無法上傳至其他類型的頁面。

這個範例會在 ID 為 FILECABINET_ENTRY_ID 參照的檔案櫃底下建立 webattachment。其標題和 (選用) 說明分別設為「GoogleLogo」和「精美顏色」。

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Type: application/atom+xml
Content-Length: 531

<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
          term="http://schemas.google.com/sites/2008#webattachment" label="webattachment"/>
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/FILECABINET_ENTRY_ID"/>
  <title>GoogleLogo</title>
  <summary>nice colors</summary>
  <content type="image/gif" src="http://www.google.com/images/logo.gif"></content>
</entry>

POST 會在使用者的檔案櫃中建立指向圖片「http://www.google.com/images/logo.gif」的連結。

返回頁首



更新內容

任何網頁的中繼資料 (標題、pageName 等) 和網頁內容都能使用單一 PUT 要求傳送至 edit 連結。 要求主體應包含描述已更新網頁的 Atom 項目。這項規則例外是附件項目,該項目只能用於更新附件的中繼資料。 如要變更附加檔案的內容,只要將原始資料新增為附件 edit-media 連結的 PUT 要求的主體即可。您也可以使用 MIME 多部分要求,一次更新中繼資料和附加檔案內容。

要宣告更新不會覆寫其他用戶端的變更,請納入原始項目的 ETag 值。方法是在 HTTP If-Match 標頭中提供 ETag 值,或是在更新的項目中加入原始項目的 gd:etag 屬性。如要判斷原始項目的 ETag 值,請檢查 <entry> 元素的 gd:etag 屬性。 如果是媒體項目,媒體的 ETag 可能位於 edit-media 連結的 gd:etag 屬性中。

如要更新項目 (無論在您擷取該項目後是否有其他人更新),請使用 If-Match: * 且不要包含 ETag。如要進一步瞭解 ETag,請參閱 Google Data API 參考指南

更新項目的中繼資料或 HTML 內容

如要更新項目的中繼資料或 HTML 內容,請將 HTTP PUT 傳送至該項目的 edit 連結。

以下是更新 listpage 項目 (以 ID ENTRY_ID 表示) 的範例,變更內容如下:

  • 標題已修改為「更新內容」
  • 已更新 HTML 內容
  • 清單的第一個欄標題更新為「擁有者」
  • 網頁的網址路徑已由 <sites:pageName> 元素修改
PUT /feeds/content/domainName/siteName/ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 816
Content-Type: application/atom+xml

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:gd="http://schemas.google.com/g/2005"
    gd:etag="W/&quot;CEEBRn0ymA9WxJWEUw.&quot;">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#listpage" label="listpage"/>
  <title>Updated Title</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Updated Content</div>
  </content>
  <gs:worksheet name="listpage"/>
  <gs:header row="1"/>
  <gs:data startRow="2">
    <gs:column index="A" name="Owner"/>
    <gs:column index="B" name="Decription"/>
    <gs:column index="C" name="Completed"/>
  </gs:data>
  <sites:pageName>newPagePath</sites:pageName>
</entry>

注意:項目 (伺服器傳回) 包含的元素數量會超過上述範例。

取代附件內容

以下範例說明如何取代附件的內容,但保留附件的中繼資料。要求包含新內容,因此會使用附件項目的 edit-media 連結。

PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 70581
Content-Type: application/msword

... doc contents here ...

更新附件中繼資料和內容

以下範例說明如何同時更新附件的中繼資料及其內容。附件名稱將更新為「New Title」,並由 .zip 檔案的內容取代。由於要求包含新的檔案內容,因此會使用附件項目的 edit-media 連結。

請注意,包含中繼資料的 ETag 也會為媒體內容提供隱含的 If-Match,因為對媒體內容的任何更新都會導致中繼資料的 ETag 變更。

PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Type: multipart/related; boundary="END_OF_PART"
--END_OF_PART
Content-Type: application/atom+xml

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq">
  <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml"
        href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/>
  <title>New Title</title>
</entry>

--END_OF_PART
Content-Type: application/zip

... zip contents here ...

--END_OF_PART

返回頁首



正在刪除內容

如要從 Google 網站移除項目,請先擷取該項目,然後將 DELETE 要求傳送至該項目的 edit 網址。更新商品中繼資料或 HTML 內容時使用的網址會是相同的。

DELETE /feeds/content/domainName/siteName/ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
If-Match: <ETag or * here>

如果該項目已成功刪除,伺服器會回應 HTTP 200 OK

如果您想確保不會在擷取完成後由其他用戶端變更的項目,請加上含有原始項目 ETag 值的 HTTP If-Match 標頭。您可以檢查 <entry> 元素的 gd:etag 屬性來判斷原始項目的 ETag 值。

如要刪除該項目 (無論在您擷取之後是否有其他人更新項目),請使用 If-Match: * 且不要包含 ETag。(在此情況中,您不需要在刪除前擷取項目)。

如要進一步瞭解 ETag,請參閱 Google Data API 參考指南

返回頁首



正在下載附件

取得附件項目後,您可以將經過驗證的 HTTP GET 傳送至項目的 <content> src 連結,藉此下載檔案。PDF 的內容連結範例:

<content type="application/pdf"
  src="http://502377765-a-google-com-s-sites.googlegroups.com/feeds/media/content/domainName/siteName/678942036"/>

返回頁首

ACL 資訊提供

共用權限 (ACL) 總覽

ACL 動態饋給中的每個 ACL 項目都代表特定實體的存取權角色,可以是使用者、使用者群組、網域或預設存取權 (公開網站)。只有明確取得存取權的實體會顯示項目;Google 協作平台 UI 的共用畫面中的「具有存取權的使用者」面板中,每個電子郵件地址會顯示一個項目。因此,系統不會顯示網域管理員,即使他們擁有網站的隱含存取權也一樣。

角色

角色元素代表實體可擁有的存取層級。gAcl:role 元素有四種可能的值:

  • Reader — 檢視者 (相當於唯讀存取權)。
  • writer:協作者 (具備讀取/寫入權限)。
  • owner:通常是網站管理員 (具備讀取/寫入權限)。

範圍

範圍元素代表具備此存取層級的實體。gAcl:scope 元素分為五種類型:

  • user:電子郵件地址值,例如「user@gmail.com」。
  • group - Google 網路論壇電子郵件地址,例如「group@domain.com」。
  • domain:G Suite 網域名稱,例如「domain.com」。
  • 邀請 - 已受邀加入網站,但尚未新增至網站的 ACL 的使用者。(如果您指定 gdata 1.3 以下版本,則無法使用這項功能)。
  • default - 「default」類型只有一個可能的範圍,且該範圍沒有值 (例如 <gAcl:scope type="default">)。這個特定範圍可控管任何使用者在公開網站上根據預設具備的存取權。

注意:網域不能將 gAcl:role 值設為「owner」(擁有者),只能是讀取者或寫入者。

「邀請」範圍簡介。

當您在 ACL 中新增一或多位使用者,但還沒有 Google 帳戶時,這個 API 會傳回邀請範圍。API 傳回的網址內含嵌入憑證,您必須將此憑證提供給受邀的使用者,他們才能接受邀請。

透過這個邀請方式,你可以邀請非 Google 使用者,不必事先瞭解對方要使用的電子郵件地址。使用者只要點按內嵌權杖的邀請網址,就能使用他們想要的電子郵件地址申請存取權。此外,多位使用者可以透過這個網址接受邀請,因此很適合用來邀請一或一組使用者。

注意:「邀請」範圍僅適用於 gdata 1.4 以上版本。如果您明確指定 1.3 以下版本,這個方法無效。

擷取 ACL 資訊提供

ACL 資訊提供可用於控管網站的共用權限,並可透過下列 URI 存取:

https://sites.google.com/feeds/acl/site/domainName/siteName
動態饋給參數說明
domainNamesite」或您 G Suite 代管網域的網域 (例如 example.com)。
siteName網站的網頁空間名稱,您可以在網站的網址中找到 (例如 myCoolSite)。

請注意,網站動態饋給中的每個項目都包含這個動態饋給的連結:

 <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>

如要擷取網站的共用權限,請將 GET 和 HTTP 傳送至 ACL 資訊提供 URI:

GET /feeds/acl/site/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

伺服器會回應 200 OK 和 ACL 項目資訊提供:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
    xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
    xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/acl/site/domainName/siteName</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<title>Acl</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
  <gAcl:scope type="user" value="userA@google.com"/>
  <gAcl:role value="owner"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
  <gAcl:scope type="user" value="userB@gmail.com"/>
  <gAcl:role value="writer"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
  <gAcl:scope type="user" value="userC@gmail.com"/>
  <gAcl:role value="reader"/>
</entry>
...
</feed>

返回頁首

共用網站

ACL 動態饋給接受 GETPOSTPUT 要求。如要在 ACL 資訊提供內插入新角色,只需向網站的 ACL 資訊提供發出 POST 要求即可。

注意:某些共用 ACL 可能只有在網域設為允許這類權限時 (例如啟用 G Suite 網域外部共用設定等) 才有可能執行。

以下範例說明如何將新的協作者 (寫入者) 新增至網站:

POST /feeds/acl/site/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/acl/2007#accessRule'/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='user' value='new_writer@example.com'/>
</entry>

成功插入後,會傳回 201 Created 和新項目:

<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='user' value='new_writer@example.com'/>
</entry>

透過「邀請」範圍邀請使用者

如果您加入的使用者沒有 Google 帳戶,API 會傳回網址,您必須提供給要邀請的使用者。使用者按下網址後,他們只要使用現有帳戶登入或建立新帳戶,即可存取協作平台。

成功的邀請會傳回 201 Created 和新的項目,其中包含您必須傳遞至使用者的網址:

<entry>
  <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com</id>
  <updated>2009-12-03T22:01:05.963Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
  <link rel="http://schemas.google.com/sites/2008#invite" type="text/html"href="domainName/siteName?invite=inviteToken"/>
  <link rel="self" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/>
  <link rel="edit" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/>
  <gAcl:role value='writer'/>
  <gAcl:scope type='invite' value='new_invite%40example.com'/>
</entry>

群組與網域層級共用

與單一使用者共用網站類似,您可以在 Google 群組或 G Suite 網域中共用網站。必要的 scope 值如下。

與群組電子郵件地址分享:

<gAcl:scope type="group" value="group@example.com"/>

與整個網域共用:

<gAcl:scope type="domain" value="example.com"/>

網域層級共用功能僅適用於 G Suite 網域,且僅適用於代管網站的網域。舉例來說,http://sites.google.com/a/domain1.com/siteA 只能與 <網域>1.com 共用整個協作平台,而無法與 <網域>2.com 共用。如果協作平台未是由 G Suite 網域 (例如 http://sites.google.com/site/siteB) 代管,就無法邀請網域。

修改共用權限

如要更新 ACL 項目,請視需要修改項目,並向項目的 edit 連結發出 HTTP PUT 要求。該連結只是 <link> 元素,其「rel」屬性已設為「edit」。就上例而言,連結為:

<link rel='edit' type='application/atom+xml'
    href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>

下列程式碼片段將「new_writer@gmail.com」的角色變更為「讀取者」:

PUT /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
  <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/>
  <gAcl:role value='reader'/>
  <gAcl:scope type='user' value='new_writer@gmail.com'/>
</entry>

正在移除共用權限

如要移除這位使用者的權限,請向 PUT 要求所使用的同一個 edit 連結發出 DELETE 要求:

DELETE /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>

伺服器會回應 200 OK

返回頁首

特殊主題

再次擷取動態饋給或項目

如要擷取先前擷取的動態饋給或項目,如要提高效率,您可以指示伺服器傳送清單或項目,前提是該清單或項目自上次擷取後有所變更。

如要執行這類條件式擷取作業,請傳送包含 HTTP If-None-Match 標頭的 HTTP GET 要求。在標頭中指定清單或項目的 ETag。您可以在 <feed> 元素或 <entry> 元素的 gd:etag 屬性中找到這些標記。

使用網站動態饋給的範例:

GET /feeds/site/domainName/myOtherTestSite/
GData-Version: 1.4
If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."

伺服器收到這項要求時,會檢查您要求的項目是否與您指定的 ETag 相同。如果 ETag 相符,則該項目並未變更,且伺服器會傳回 HTTP 304 Not Modified 狀態碼或 HTTP 412 Precodition Failed 狀態碼。這兩個狀態碼都表示,您擷取的項目是最新版本。

如果 ETag 不符,表示項目自您上次要求後已修改,且伺服器會傳回商品。

如要進一步瞭解 ETag,請參閱 Google Data API 參考指南

批次處理

批次要求可讓您的客戶在單一要求中執行多項作業,而不必個別提交每項作業。

伺服器會盡可能執行要求的變更,並傳回狀態資訊,供您評估每項作業的成功或失敗情形。如要進一步瞭解 Google Data API 中的批次處理,請參閱使用 Google Data API 進行批次處理一文。

除了插入作業之外,批次動態饋給中的每項作業都有 <id> 元素。這個元素和您平常更新、刪除或查詢內容動態饋給時使用的要求網址相同。舉例來說,如果您要更新編輯內容,請將 <id> 設為相關項目的 edit 連結。用於識別目標項目。新項目尚未建立,因此沒有 <id> 元素。您可以改為在 <batch:id> 中定義字串值,這個值會在伺服器的回應中傳回,並用來查詢對應的項目。

如要提出批次要求,請建構批次動態饋給,並將 HTTP POST 傳送至動態饋給的批次連結:

<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/batch"/>

以下範例說明如何查詢、插入、更新及刪除網頁項目:

POST /feeds/content/site/siteName/batch HTTP/1.1
Host: sites.google.com
Accept: */*
If-Match: *
GData-Version: 1.4
Authorization: <your authorization header here>

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"
      xmlns:gd="http://schemas.google.com/g/2005" xmlns:batch='http://schemas.google.com/gdata/batch'>
  <entry>
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
    <batch:operation type="query"/>
  </entry>
  <entry>
    <batch:id>1</batch:id>
    <batch:operation type='insert'/>
    <category scheme="http://schemas.google.com/g/2005#kind"
        term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
    <title>New Webpage1</title>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div>
    </content>
  </entry>
  <entry gd:etag="&quot;YDgpeyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
    <batch:operation type='update'/>
    <category scheme="http://schemas.google.com/g/2005#kind"
        term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
    <title>Updated Title for Webpage2</title>
    ...
    <batch:operaation type="update"/>
  </entry>
  <entry gd:etag="&quot;YassseyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
    <batch:operation type='delete'/>
  </entry>
</feed>

傳回的動態饋給會包含每項作業的一個結果項目:

 
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
    xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
    xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
    xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
<updated>2009-11-10T22:44:08.369Z</updated>
<title>Batch Feed</title>
<entry gd:etag="&quot;YDgpsdfeyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
  <published>2009-08-31T04:42:45.251Z</published>
  <updated>2009-10-25T22:46:13.729Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-25T22:46:13.671Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Page Title</title>
  ...
  <batch:status code="200" reason="Success"/>
  <batch:operation type="query"/>
</entry>
<entry gd:etag="&quot;YDsseyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID4</id>
  <published>2009-11-10T22:44:08.531Z</published>
  <updated>2009-11-10T22:44:08.560Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-10T22:44:08.531Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>New Webpage1</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
    <table cellspacing="0" class="sites-layout-name-one-column sites-layout-hbox">
      <tbody>
        <tr>
          <td class="sites-layout-tile sites-tile-name-content-1">
            <div>HTML body goes here</div>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</content>
...
<batch:id>1</batch:id>
<batch:status code="201" reason="Created"/>
<batch:operation type="insert"/>
</entry>
<entry gd:etag="&quot;YDkpeyI.&quot;">
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
  <updated>2009-11-10T22:44:09.296Z</updated>
  <title>Updated Title for Webpage2</title>
  ...
  <sites:pageName>updated-title-for-webpage2</sites:pageName>
  <sites:revision>5</sites:revision>
  <batch:status code="200" reason="Success"/>
  <batch:operation type="update"/>
</entry>
<entry>
  <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
  <title>Deleted</title>
  <content>Deleted</content>
  <batch:status code="200" reason="Success"/>
  <batch:operation type="delete"/>
</entry>
</feed>

返回頁首