通訊協定指南

傳統版 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>

上述要求會使用「字卡」建立新的 Google 網站G Suite 網域 example.com 中設定的主題。 網站網址會是 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>

這個範例會新增兩個類別:「團隊網站」以及「Legal Department」

網址對應

網址對應可讓協作平台使用者將自己的網域對應至 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>

現有的對應會顯示為包含 rel='webAddressMapping' 的 link。例如,在上述範例中 有三個 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,方法是將連結移出項目:

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 標頭,並參照取得的權杖 「授權要求」一節。

返回頁首

內容動態饋給

擷取內容

內容資訊提供會列出「Google 協作平台」目前的內容。將經過驗證的 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>

注意:以上僅列出前幾項結果。如要逐頁瀏覽整個內容動態饋給,請 動態饋給的「Next」連結:

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

如需 Atom 常見元素的說明,請參閱 Google Data Protocol 參考資料。 以下將說明使用傳統版協作平台 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 查詢參數搜尋內容動態饋給。 以及傳統版協作平台 API 的特定檔案如需詳細資訊和完整的支援參數清單,請參閱 參考指南

擷取特定項目種類

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

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

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

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 參數。

建立新項目 / 頁面

此範例會在網站頂層之下建立新的 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」和 標題為「新網頁標題」。也就是說,網址的 <atom:title> 會正規化為 new-webpage-title。 如要自訂網頁網址的網址路徑,請設定 <sites:pageName> 元素。

這個範例會建立頁面標題為「File Storage」的新 filecabinet,但建立了頁面 「http://sites.google.com/domainName/siteName/files」之下的 請指定 <sites:pageName> 元素

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」這個參數不會被伺服器接受

建立子頁面

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

本範例會在上層公告頁面中,建立含有「公告」標題的新 announcement。 ID:PARENT_ENTRY_ID。也會包含網頁內文的 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」和「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>

使用範本建立頁面

與建立頁面範本類似,只要加入具有 rel='http://schemas.google.com/sites/2008#template' 的 <link>,即可從範本例項化新頁面指向 頁面範本的自我連結

本範例使用定義檔案櫃頁面的現有頁面範本建立新的 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」以及「nice color」

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」的圖片連結。

返回頁首



更新內容

只要透過對 edit 連結提出的單一 PUT 要求,即可編輯任何網頁的中繼資料 (標題、pageName 等) 和網頁內容。 要求主體應包含描述已更新頁面的 Atom 項目。但這項規則的例外是附件項目,其項目只能用於更新附件的中繼資料。 如要變更附加檔案的內容,只要在 PUT 要求的主體中加入原始資料 附件的 edit-media 連結。此外,您也可以使用 MIME 多部分要求。

如要宣告您的更新不會覆寫其他用戶端的變更,請加入原始項目的 ETag 值。方法如下: 提供 ETag 值時使用 HTTP If-Match 標頭,或是在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 ...

更新附件中繼資料和內容

以下範例說明如何同時更新附件的中繼資料及其內容。連結名稱將會更新 「新標題」並將檔案內容換成 .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 標頭。您可以透過下列方式判斷原始項目的 ETag 值: 檢查 <entry> 元素的 gd: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 項目都代表特定實體的存取權角色,可以是使用者、使用者群組、網域 或預設存取權 (為公開網站)僅有明確存取權的實體會顯示項目 - 將顯示一個項目 為「有權存取的使用者」中的每個電子郵件地址面板。因此,系統不會顯示網域管理員 即使他們可以透過隱含存取網站也沒問題。

角色

角色元素代表實體可擁有的存取層級。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」僅是讀者或作者。

關於「邀請」範圍。

當您將一或多位使用者新增至尚未擁有 Google 帳戶的 ACL 時,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"/>

如要擷取網站的共用權限,請傳送 HTTP GET 和 HTTP GET 到 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 只能與 domain1.com 共用協作平台,而不能與 domain2.com 共用。如果網站不是由 G Suite 網域 (例如 http://sites.google.com/site/siteB) 代管,就無法邀請網域。

修改共用權限

如要更新 ACL 項目,請視需要修改項目,然後向PUT 項目的 edit 連結 <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 的 HTTP GET 要求 If-None-Match 標頭。在標頭中指定清單或項目的 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 進行批次處理

批次動態饋給中的每個作業都包含 &lt;id&gt; 元素,但不包括插入作業。 此元素與更新、刪除或查詢內容資訊提供時通常使用的要求網址相同。 舉例來說,如果您要更新某項編輯內容,請將 &lt;id&gt; 設為相關內容的 edit 連結。 用於識別目標項目。新項目沒有 &lt;id&gt; 元素,因為 表示尚未建立。您可以改在 &lt;batch:id&gt; 中定義字串值, 並用來查詢對應的項目。

如要進行批次要求,請建立批次動態饋給,並傳送 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>

返回頁首