傳統版 Google Sites API 可讓應用程式存取、發布及修改 Google 協作平台中的內容。此外,應用程式可以要求近期活動清單、擷取修訂版本記錄,以及上傳/下載附件和檔案。
目標對象
本文假設您已瞭解 Google Data API 協定的基本概念。
本文適用於想編寫用戶端應用程式,與 Google 協作平台互動的程式設計人員。本文件提供一系列使用原始 XML/HTTP 進行基本 Data API 互動的範例,並附有說明。閱讀本文後,您可以參閱左側導覽列中其他指南的特定語言範例,進一步瞭解如何使用用戶端程式庫與 API 互動。
如需本指南中的資料參考資料,請參閱參考指南。
授權要求
如果應用程式要求存取非公開的使用者資料,就必須提供授權權杖。這個權杖也可讓 Google 識別您的應用程式。
關於授權通訊協定
您的應用程式必須使用 OAuth 2.0 對要求進行授權,系統不支援其他授權通訊協定。如果您的應用程式採用使用 Google 帳戶登入功能,系統會為您處理部分授權事項。
使用 OAuth 2.0 對要求進行授權
向 Google 協作平台 Data API 提出的非公開使用者資料要求,必須由經過驗證的使用者授權。
OAuth 2.0 授權程序 (或「流程」) 的細節會根據您編寫的應用程式類型而有所不同。下列一般程序適用於所有應用程式類型:
- 建立應用程式後,請透過 Google API 控制台註冊應用程式。Google 會向您提供稍後需要的資訊,例如用戶端 ID 和用戶端密鑰。
- 在 Google API 控制台中啟用 Google 協作平台 Data API(如果 API 控制台裡沒有列出該 API,則可略過這個步驟)。
- 當應用程式需要存取使用者資料時,會向 Google 要求特定的存取範圍。
- Google 會向使用者顯示同意畫面,請對方授權您的應用程式要求部分資料。
- 如果使用者同意,Google 即會授予短期存取權杖給您的應用程式。
- 您的應用程式向使用者要求資料,並且在要求中附上存取權杖。
- 如果 Google 判定您的要求與權杖有效,便會傳回您要求的資料。
部分流程包含額外步驟,例如使用「更新權杖」來取得新的存取權杖。如要進一步瞭解各類應用程式的流程,請參閱 Google 的 OAuth 2.0 說明文件。
以下是 Google 協作平台 Data API 的 OAuth 2.0 範圍資訊:
https://sites.google.com/feeds/
如要透過 OAuth 2.0 要求存取權,您的應用程式需要範圍資訊,以及 Google 在您註冊應用程式時提供的資訊 (例如用戶端 ID 和用戶端密鑰)。
指定版本
您向 Google 協作平台 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| 動態饋給參數 | 說明 |
|---|---|
domainName | 「site」或 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/"CkUAQH4_eil7I2A9WxNaFk4.""> <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/"DkQGQHczfA9WxNaFk4.""> <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 下,建立一個採用「slate」主題的新版 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/"DEECR38l7I2A9WxNaF0Q."">
<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/"DEECR38l7I2A9WxNaF0Q.""> <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/"DEECR38l7I2A9WxNaF0Q.""> <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>
這個範例會編輯現有網站,並新增「Team Site」類別。
你也可以新增多個 <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/"DEECR38l7I2A9WxNaF0Q.""> <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>
這個範例會新增兩個類別:「Team Site」和「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/"DkQGQHczfA9WxNaFk4.""> <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:
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/"DkQGQHczfA9WxNaFk4.""> <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
| 動態饋給參數 | 說明 |
|---|---|
domainName | 「site」或 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/"CU4GQ3szfSl7ImA9WxNRFUg.""> <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/"CU8DQn45fyl7ImA9WxNRFUg.""> <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/"CU8AR3s4cSl7ImA9WxNRFUg.""> <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
| 動態饋給參數 | 說明 |
|---|---|
domainName | 「site」或 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/"CU4GQmA9WxNRFUg.""> <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&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/"CU8DQ388eSl7ImA9WxNRFUg.""> <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&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
| 動態饋給參數 | 說明 |
|---|---|
domainName | 「site」或 G Suite 代管網域的網域 (例如 example.com)。 |
siteName | 網站的網頁空間名稱,可在網站網址中找到 (例如 myCoolSite)。 |
結果會是列出網站上第一頁內容項目的動態饋給。動態饋給中的每個項目都代表不同類型的內容項目,例如 webpage、filecabinet、attachment、comment 等。<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/"Ck8GQXk7fil7ImA9WxNSFk0.""> <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/"CkMBQH08fCl7ImA9WxNSFk0.""> <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/"AkYHQ3ozcCl7ImA9WxJaE08.""> <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 參考資料。以下說明對傳統版協作平台 Sites 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-drafts 或 include-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 下,且網頁標題為「New Webpage Title」。也就是說,網址中的 <atom:title> 會正規化為 new-webpage-title。如要自訂頁面的網址路徑,可以設定 <sites:pageName> 元素。
這個範例會建立新的 filecabinet,頁面標題為「File Storage」,但會指定 <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>
伺服器會使用下列優先順序規則,為頁面的網址路徑命名:
<sites:pageName>(如有)。必須符合a-z, A-Z, 0-9, -, _。<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 File」,說明為「HR packet」(選填)。
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 colors」。
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 值。方法是在 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 表示),並進行下列變更:
- 標題已修改為「Updated Content」
- 更新後的 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/"CEEBRn0ymA9WxJWEUw.""> <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="Description"/> <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。
如要確保不會刪除其他用戶端在您擷取後變更的項目,請加入 HTTP If-Match 標頭,其中包含原始項目的 ETag 值。您可以檢查 <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 協作平台使用者介面共用畫面中「有存取權的使用者」面板中的每個電子郵件地址都會顯示一個項目。因此,即使網域管理員具有網站的隱含存取權,也不會顯示。
角色
角色元素代表實體可擁有的存取層級。gAcl:role 元素有四個可能的值:
- reader:檢視者 (相當於唯讀存取權)。
- writer:協作者 (等同於讀取/寫入權限)。
- 擁有者:通常是網站管理員 (相當於讀取/寫入權限)。
範圍
範圍元素代表具有這個存取層級的實體。gAcl:scope 元素有五種可能類型:
- user:電子郵件地址值,例如「user@gmail.com」。
- group:Google 群組電子郵件地址,例如「group@domain.com」。
- domain:G Suite 網域名稱,例如「domain.com」。
- invite:已受邀加入網站,但尚未加入網站 ACL 的使用者。(如果指定 gdata 1.3 以下版本,則無法使用)。
- default:只有一個可能的「default」類型範圍,沒有值 (例如
<gAcl:scope type="default">)。這個特定範圍控制任何使用者在公開網站上預設擁有的存取權。
注意:網域的 gAcl:role 值無法設為「擁有者」存取權,只能設為讀取者或寫入者。
關於「邀請」範圍。
當您將一或多位沒有 Google 帳戶的使用者加入 ACL 時,API 會傳回邀請範圍。API 會傳回內嵌權杖的網址,您必須將這個網址提供給受邀使用者,他們才能接受邀請。
這種邀請方式可讓您邀請非 Google 使用者,而不必事先知道他們想使用的電子郵件地址。只要使用者點選內嵌權杖的邀請網址,就能使用任何電子郵件地址註冊存取權。此外,多位使用者可能使用這個網址接受邀請,因此在邀請一位使用者或一組使用者時,這個網址可能很有用。
注意:「invite」範圍僅適用於 gdata 1.4 以上版本。如果您明確指定 1.3 以下版本,則無法使用這項功能。
擷取 ACL 動態饋給
ACL 動態饋給可用於控管網站的共用權限,並可透過下列 URI 存取:
https://sites.google.com/feeds/acl/site/domainName/siteName
| 動態饋給參數 | 說明 |
|---|---|
domainName | 「site」或 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 傳送至 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 動態饋給接受 GET、POST 和 PUT 要求。如要在 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 項目,請視需要修改項目,並向項目的 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 的角色變更為「reader」:
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=""YDgpeyI.""> <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=""YassseyI.""> <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=""YDgpsdfeyI."">
<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=""YDsseyI."">
<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=""YDkpeyI."">
<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>