Google Sites API แบบคลาสสิกช่วยให้แอปพลิเคชันของคุณเข้าถึง เผยแพร่ และแก้ไขเนื้อหาภายใน Google Sites ได้ นอกจากนี้ แอปพลิเคชันของคุณยังสามารถขอรายการกิจกรรมล่าสุด ดึงข้อมูลประวัติการแก้ไข และอัปโหลด/ดาวน์โหลดไฟล์แนบและไฟล์ได้อีกด้วย
ผู้ชม
เอกสารนี้มีการถือว่าคุณเข้าใจแนวคิดทั่วไปที่อยู่เบื้องหลังโปรโตคอล Google Data API
เอกสารนี้มีไว้สำหรับโปรแกรมเมอร์ที่ต้องการเขียนแอปพลิเคชันไคลเอ็นต์ที่โต้ตอบกับ Google Sites ได้ โดยจะยกตัวอย่างการโต้ตอบกับ API ข้อมูลพื้นฐานที่ใช้ XML/HTTP แบบ RAW พร้อมคำอธิบาย หลังจากอ่านเอกสารนี้แล้ว คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับการโต้ตอบกับ API โดยใช้ไลบรารีของไคลเอ็นต์ได้โดยอ่านตัวอย่างเฉพาะภาษาที่พบในคู่มืออื่นๆ ในแถบนำทางด้านซ้าย
สำหรับข้อมูลอ้างอิงของเนื้อหาในคู่มือนี้ โปรดดูคู่มือข้อมูลอ้างอิง
การอนุญาตคำขอ
เมื่อแอปพลิเคชันขอข้อมูลผู้ใช้ที่ไม่เผยแพร่ต่อสาธารณะ ก็ต้องมีโทเค็นการให้สิทธิ์ด้วย โทเค็นดังกล่าวจะระบุตัวตนแอปพลิเคชันของคุณให้ Google ทราบด้วย
เกี่ยวกับโปรโตคอลการให้สิทธิ์
แอปพลิเคชันต้องใช้ OAuth 2.0 เพื่อให้สิทธิ์คำขอ ระบบไม่รองรับโปรโตคอลการให้สิทธิ์อื่นๆ หากแอปพลิเคชันใช้ลงชื่อเข้าใช้ด้วย Google ระบบจะจัดการการให้สิทธิ์บางส่วนแก่คุณ
การให้สิทธิ์คำขอด้วย OAuth 2.0
คำขอที่ส่งไปยัง Google Sites Data API สำหรับข้อมูลผู้ใช้ที่ไม่เผยแพร่ต่อสาธารณะจะต้องได้รับอนุญาตจากผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว
รายละเอียดของกระบวนการให้สิทธิ์หรือ "ขั้นตอน" ของ OAuth 2.0 จะแตกต่างกันไปโดยขึ้นอยู่กับประเภทของแอปพลิเคชันที่คุณเขียน แอปพลิเคชันทุกประเภทจะใช้กระบวนการทั่วไปต่อไปนี้
- เมื่อสร้างแอปพลิเคชัน คุณจะลงทะเบียนแอปได้โดยใช้คอนโซล Google API จากนั้น Google จะให้ข้อมูลที่คุณต้องใช้ในภายหลัง เช่น รหัสไคลเอ็นต์และรหัสลับไคลเอ็นต์
- เปิดใช้งาน Google Sites Data API ในคอนโซล Google API (หากไม่เห็น API ดังกล่าวในคอนโซล API ให้ข้ามขั้นตอนนี้ไป)
- เมื่อแอปพลิเคชันต้องการเข้าถึงข้อมูลผู้ใช้ แอปจะขอขอบเขตการเข้าถึงที่จำเป็นจาก Google
- Google จะแสดงหน้าจอขอคำยินยอมแก่ผู้ใช้เพื่อขอให้ผู้ใช้ให้สิทธิ์แอปพลิเคชันของคุณในการขอข้อมูลบางอย่างของผู้ใช้
- หากผู้ใช้อนุมัติ Google จะให้โทเค็นเพื่อการเข้าถึงที่มีอายุชั่วคราวแก่แอปพลิเคชันของคุณ
- แอปพลิเคชันขอข้อมูลผู้ใช้โดยแนบโทเค็นเพื่อการเข้าถึงไปกับคำขอ
- หาก Google ตัดสินว่าคำขอและโทเค็นของคุณถูกต้อง ระบบจะแสดงข้อมูลที่ขอ
บางกระบวนการจะมีขั้นตอนเพิ่มเติม เช่น การใช้โทเค็นการรีเฟรชเพื่อขอโทเค็นเพื่อการเข้าถึงใหม่ ดูข้อมูลอย่างละเอียดเกี่ยวกับกระบวนการของแอปพลิเคชันประเภทต่างๆ ได้ที่เอกสารประกอบเกี่ยวกับ OAuth 2.0 ของ Google
ข้อมูลขอบเขตของ OAuth 2.0 สำหรับ Google Sites Data API มีดังนี้
https://sites.google.com/feeds/
หากต้องการขอสิทธิ์โดยใช้ OAuth 2.0 แอปพลิเคชันของคุณต้องมีข้อมูลขอบเขต รวมถึงข้อมูลที่ Google ให้คุณตอนลงทะเบียนแอปพลิเคชัน (เช่น รหัสไคลเอ็นต์และรหัสลับไคลเอ็นต์)
การระบุเวอร์ชัน
ทุกคำขอที่ส่งไปยัง Google Sites Data API ควรระบุเวอร์ชัน 1.4 หากต้องการระบุหมายเลขเวอร์ชัน ให้ใช้ส่วนหัว HTTP ของ GData-Version
ดังนี้
GData-Version: 1.4
หรือหากตั้งค่าส่วนหัว HTTP ไม่ได้ คุณก็ระบุ v=1.4
เป็นพารามิเตอร์การค้นหาใน URL ได้ แต่ขอแนะนำให้ใช้ส่วนหัว HTTP หากเป็นไปได้
หมายเหตุ: ไลบรารีของไคลเอ็นต์จะส่งส่วนหัวเวอร์ชันที่เหมาะสมให้โดยอัตโนมัติ ดังนั้นอย่าใช้พารามิเตอร์การค้นหา v=1.4
เมื่อคุณใช้ไลบรารีของไคลเอ็นต์
ฟีดของเว็บไซต์
ฟีดเว็บไซต์สามารถใช้เพื่อแสดง Google Sites ที่ผู้ใช้เป็นเจ้าของหรือมีสิทธิ์ในการดู และยังแก้ไขชื่อของเว็บไซต์ที่มีอยู่ได้ด้วย สำหรับโดเมน G Suite จะใช้เพื่อสร้างหรือคัดลอกทั้งเว็บไซต์ได้ด้วย
รายชื่อไซต์
หากต้องการแสดงเว็บไซต์ที่ผู้ใช้มีสิทธิ์เข้าถึง ให้ส่งคำขอ GET
ที่ตรวจสอบสิทธิ์แล้วไปยัง URL ต่อไปนี้
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>
คำขอข้างต้นจะสร้างเว็บไซต์จาก Google Sites ใหม่ที่มีธีม "แถบสเลท" ภายใต้โดเมน G Suite example.com
URL ของเว็บไซต์จะเป็น 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 เท่านั้น
เว็บไซต์ที่มีอยู่สามารถทำซ้ำในลักษณะเดียวกับการสร้างเว็บไซต์ใหม่ แต่ในรายการ Atom ของคําขอ POST
ให้ใส่ <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 Sites
- คุณสามารถคัดลอกเว็บไซต์จากโดเมนอื่นได้ เนื่องจากต้องรอการแสดงว่าคุณเป็นเจ้าของในเว็บไซต์ต้นทาง
การอัปเดตข้อมูลเมตาของเว็บไซต์
หากต้องการอัปเดตชื่อหรือข้อมูลสรุปของเว็บไซต์ ให้ส่ง 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>
ตัวอย่างนี้แก้ไขเว็บไซต์ที่มีอยู่แล้ว และเพิ่มหมวดหมู่เป็น "เว็บไซต์ของทีม"
และยังเพิ่มได้หลายหมวดหมู่โดยการเพิ่มแท็ก <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>
ตัวอย่างนี้ได้เพิ่ม 2 หมวดหมู่ ได้แก่ "เว็บไซต์ของทีม" และ "ฝ่ายกฎหมาย"
การแมปที่อยู่เว็บ
การแมปที่อยู่เว็บช่วยให้ผู้ใช้ Sites แมปโดเมนของตนเองกับ Google Sites ได้ เช่น คุณใช้ 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
3 รายการที่ชี้ไปยังเว็บไซต์ http://sites.google.com/site/myOtherTestSite
การแก้ไขการแมปที่อยู่เว็บ
หมายเหตุ: การดำเนินการ GET/POST/PUT ทั้งหมดควรระบุพารามิเตอร์ with-mappings=true
เมื่อทำงานกับการแมปที่อยู่เว็บ หากไม่มีพารามิเตอร์นี้ ระบบจะไม่แสดงผล webAddressMapping
ในรายการเว็บไซต์ (GET) หรือพิจารณาเมื่ออัปเดต/นำการแมป (PUT) ออกจากรายการ
หากต้องการเพิ่ม อัปเดต หรือลบการแมป เพียงระบุ เปลี่ยน หรือนำลิงก์ดังกล่าวออกเมื่อสร้างเว็บไซต์ใหม่หรืออัปเดตข้อมูลเมตาของเว็บไซต์ ต้องรวมพารามิเตอร์ with-mappings=true
ไว้ใน URI ของฟีดเว็บไซต์
หมายเหตุ: หากต้องการอัปเดตการจับคู่ที่อยู่ คุณจะต้องเป็นผู้ดูแลเว็บไซต์หรือผู้ดูแลระบบโดเมนในกรณีที่เป็นเว็บไซต์ที่โฮสต์โดย 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
ไปยัง URL ของฟีดกิจกรรม
https://sites.google.com/feeds/activity/domainName/siteName
พารามิเตอร์ฟีด | คำอธิบาย |
---|---|
domainName | "site " หรือโดเมนของโดเมนที่ฝากบริการ G Suite ของคุณ (เช่น example.com ) |
siteName | ชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งพบใน URL ของเว็บไซต์ (เช่น 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 | ชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งพบใน URL ของเว็บไซต์ (เช่น myCoolSite ) |
หากต้องการค้นหาลิงก์การแก้ไขสำหรับหน้า/ความคิดเห็น/ไฟล์แนบ/listitem หนึ่งๆ ให้เรียกรายการจากฟีดเนื้อหาก่อนโดยใช้ 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
ที่ถูกต้องและอ้างอิงโทเค็นที่ได้รับในการให้สิทธิ์คำขอ
ฟีดเนื้อหา
กำลังเรียกดูเนื้อหา
ฟีดเนื้อหาจะแสดงเนื้อหาปัจจุบันของ Sites ส่งคำขอ GET
ที่ผ่านการตรวจสอบสิทธิ์ไปยัง URL ต่อไปนี้
https://sites.google.com/feeds/content/domainName/siteName
พารามิเตอร์ฟีด | คำอธิบาย |
---|---|
domainName | "site " หรือโดเมนของโดเมนที่ฝากบริการ G Suite ของคุณ (เช่น example.com ) |
siteName | ชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งพบใน URL ของเว็บไซต์ (เช่น 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>
หมายเหตุ: นี่เป็นผลการค้นหา 2-3 รายการแรกเท่านั้น หากต้องการเลื่อนดูฟีดเนื้อหาทั้งหมด ให้คลิกลิงก์ "ถัดไป" ของฟีด
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
โปรดดูคำอธิบายเกี่ยวกับองค์ประกอบทั่วไปสำหรับ Atom ที่ข้อมูลอ้างอิงโปรโตคอลข้อมูลของ Google
องค์ประกอบที่มีการวัดเฉพาะสำหรับ Sites API คลาสสิกจะแสดงอยู่ด้านล่าง บางรายการจะมีพร็อพเพอร์ตี้เพิ่มเติม (ที่ไม่ได้ระบุไว้ด้านล่าง) แต่รายการอื่นๆ จะไม่มี ตัวอย่างเช่น รายการ listitem
อาจมีองค์ประกอบ <gs:field>
ในขณะที่รายการ webpage
ไม่มี
องค์ประกอบ | คำอธิบาย |
---|---|
<content ...> | ข้อความด้านในคือส่วนเนื้อหา HTML ของหน้าเว็บ สำหรับบางรายการ (เช่น ไฟล์แนบ) องค์ประกอบนี้จะมีแอตทริบิวต์ src ที่ชี้ไปยังไฟล์ |
<link rel="alternate" ...> | ลิงก์ไปยังหน้าหรือรายการใน Google Sites |
<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> | ชื่อพื้นที่เว็บของหน้า ซึ่งสอดคล้องกับชื่อใน URL ของหน้าเว็บ |
<sites:revision> | หมายเลขเวอร์ชันปัจจุบัน |
ตัวอย่างการค้นหาฟีดเนื้อหา
คุณจะค้นหาฟีดเนื้อหาได้โดยใช้พารามิเตอร์การค้นหา Google Data API มาตรฐานบางส่วนและพารามิเตอร์เฉพาะของ Sites API แบบคลาสสิก ดูข้อมูลโดยละเอียดเพิ่มเติมและรายการพารามิเตอร์ทั้งหมดที่รองรับได้ที่คู่มืออ้างอิง
กำลังเรียกชนิดรายการที่เฉพาะเจาะจง
หากต้องการดึงข้อมูลเฉพาะรายการประเภทหนึ่งๆ ให้ใช้พารามิเตอร์ kind
ตัวอย่างนี้ส่งคืนรายการเพียง webpage
รายการ:
GET /feeds/content/domainName/siteName?kind=webpage
หากต้องการแสดงผลมากกว่า 1 ประเภท ให้คั่น kind
แต่ละรายการด้วย "," ตัวอย่างนี้จะแสดงผล filecabinet
และ listpage
ดังนี้
GET /feeds/content/domainName/siteName?kind=filecabinet,listpage
หรือคุณจะใช้รูปแบบมาตรฐานสำหรับการค้นหาข้อมูล /-/category
ใน Google แทนพารามิเตอร์ kind
ก็ได้ ดังนี้
GET /feeds/content/domainName/siteName/-/filecabinet|listpage
การเรียกเทมเพลตของหน้าเว็บ
ตัวอย่างนี้แสดงเพียง template
หน้า
GET /feeds/content/domainName/siteName/-/template
หากต้องการแสดงผลประเภทรายการทั้งหมดและมี template
หน้า ให้ใช้
GET /feeds/content/domainName/siteName/-/template|-template
การเรียกดูหน้าเว็บตามเส้นทาง
หากคุณทราบเส้นทางแบบสัมพัทธ์ของหน้าเว็บภายในเว็บไซต์จาก Google Sites ก็สามารถใช้พารามิเตอร์ path
เพื่อดึงข้อมูลหน้าดังกล่าว
ตัวอย่างนี้จะแสดงผลหน้าเว็บซึ่งอยู่ที่ http://sites.google.com/site/siteName/path/to/the/page
:
GET /feeds/content/domainName/siteName?path=/path/to/the/page
ดึงข้อมูลรายการทั้งหมดภายใต้หน้าหลัก
หากทราบรหัสรายการของหน้าเว็บ คุณจะใช้พารามิเตอร์ 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 บางส่วนสำหรับเนื้อหาของหน้า และตั้งชื่อส่วนหัวเป็น "ชื่อหน้าเว็บใหม่"
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
และสำเนาของรายการ
การสร้างรายการ/หน้าเว็บภายใต้เส้นทาง URL ที่กำหนดเอง
โดยค่าเริ่มต้น ตัวอย่างก่อนหน้านี้จะสร้างขึ้นใต้ URL http://sites.google.com/domainName/siteName/new-webpage-title
และมีส่วนหัวเป็น "ชื่อหน้าเว็บใหม่" กล่าวคือ <atom:title>
จะได้รับการปรับให้เป็น new-webpage-title
สำหรับ URL
หากต้องการปรับแต่งเส้นทาง URL ของหน้าเว็บ ให้ตั้งค่าองค์ประกอบ <sites:pageName>
ตัวอย่างนี้สร้าง filecabinet
ใหม่ที่มีส่วนหัวเป็น "File Storage" แต่สร้างหน้าภายใต้ URL 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>
เซิร์ฟเวอร์ใช้กฎลำดับความสำคัญต่อไปนี้ในการตั้งชื่อเส้นทาง URL ของหน้าเว็บ
<sites:pageName>
(หากมี) ต้องเป็นไปตามa-z, A-Z, 0-9, -, _
<atom:title>
ต้องไม่เป็นค่าว่างหากไม่มี pageName อยู่ การปรับให้เป็นมาตรฐานคือการตัด + ยุบช่องว่างเป็น "-" และนำอักขระที่ไม่ตรงกับa-z, A-Z, 0-9, -, _
ออก
ตัวอย่างเช่น เซิร์ฟเวอร์จะยอมรับ "Custom_Page2"
การสร้างหน้าย่อย
หากต้องการสร้างหน้าย่อย (หน้าย่อย) ภายใต้หน้าหลัก ให้ใส่ <link rel="http://schemas.google.com/sites/2008#parent">
ในรายการ Atom ใหม่ ตั้งค่าแอตทริบิวต์ href
ของลิงก์เป็นลิงก์เข้าเองของรายการหลัก
ตัวอย่างนี้สร้าง announcement
ใหม่ที่มีส่วนหัว "ประกาศ" ในหน้าประกาศหลักที่มีรหัสรายการ PARENT_ENTRY_ID
เนื้อหา XML สำหรับส่วนเนื้อหาของหน้ายังประกอบด้วย:
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>
เซิร์ฟเวอร์ก็จะปฏิเสธองค์ประกอบดังกล่าว
กำลังอัปโหลดไฟล์
API ช่วยให้คุณสามารถอัปโหลดไฟล์แนบไปยังหน้าจัดการไฟล์และหน้าหลักได้เช่นเดียวกับใน Google Sites
หากต้องการอัปโหลดไฟล์แนบไปยังระดับบนสุด ให้ส่งคำขอ HTTP POST
ไปยัง URL ของฟีดเนื้อหาดังนี้
https://sites.google.com/feeds/content/domainName/siteName
ส่วนเนื้อหา POST
ควรเป็นคำขอแบบหลายส่วนของ MIME เพื่อรวมเนื้อหาไฟล์กับ <atom:entry>
ที่มีข้อมูลเมตาของไฟล์แนบ <atom:entry>
ควรอ้างอิงลิงก์ของตนเองของรายการระดับบนสุด เพื่อระบุตำแหน่งที่จะสร้างไฟล์แนบ
ดูข้อมูลเพิ่มเติมที่การสร้างหน้าย่อย
กำลังอัปโหลดไฟล์แนบ
ด้านล่างนี้เป็นตัวอย่างการอัปโหลดไฟล์ PDF ไปยังตู้เก็บไฟล์ที่มีรหัส 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">
ไฟล์แนบจากเว็บ
ไฟล์แนบในเว็บเป็นไฟล์แนบชนิดพิเศษ ที่สำคัญคือลิงก์เหล่านี้ไปยังไฟล์อื่นๆ ในเว็บที่คุณสามารถเพิ่มไปยังรายการหน้าจัดการไฟล์ได้ คุณลักษณะนี้คล้ายกับวิธีการอัปโหลด "เพิ่มไฟล์ตาม URL" ใน UI ของ Google Sites
หมายเหตุ: ไฟล์แนบในเว็บจะสร้างได้ในส่วนจัดการไฟล์เท่านั้น โดยจะอัปโหลดไปยังหน้าประเภทอื่นๆ ไม่ได้
ตัวอย่างนี้จะสร้าง webattachment
ใต้จัดการไฟล์ที่อ้างอิงโดยรหัส FILECABINET_ENTRY_ID
ชื่อและรายละเอียด (ไม่บังคับ) จะถูกตั้งค่าเป็น "GoogleLogo" และ "สีสวยๆ" ตามลำดับ
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: application/atom+xml Content-Length: 531 <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webattachment" label="webattachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/FILECABINET_ENTRY_ID"/> <title>GoogleLogo</title> <summary>nice colors</summary> <content type="image/gif" src="http://www.google.com/images/logo.gif"></content> </entry>
POST
จะสร้างลิงก์ในตัวเก็บไฟล์ของผู้ใช้ที่ชี้ไปยังรูปภาพที่ "http://www.google.com/images/logo.gif"
การอัปเดตเนื้อหา
คุณแก้ไขข้อมูลเมตา (ชื่อ, pageName ฯลฯ) และเนื้อหาของหน้าเว็บใดก็ได้ด้วยคำขอ PUT
เดียวที่ส่งไปยังลิงก์ edit
เนื้อหาคำขอควรมีรายการ Atom ที่อธิบายหน้าเว็บที่อัปเดต ข้อยกเว้นสำหรับกฎนี้คือรายการไฟล์แนบ ซึ่งรายการนั้นสามารถใช้เพื่ออัปเดตข้อมูลเมตาของไฟล์แนบเท่านั้น
หากต้องการเปลี่ยนเนื้อหาของไฟล์แนบ เพียงใส่ข้อมูลดิบเป็นส่วนเนื้อหาของคำขอ PUT
ในลิงก์ edit-media
ของไฟล์แนบ นอกจากนี้ คุณสามารถอัปเดตทั้งข้อมูลเมตาและเนื้อหาไฟล์แนบได้พร้อมกันโดยใช้คำขอหลายส่วนของ MIME
หากต้องการยืนยันว่าการอัปเดตไม่ได้เขียนทับการเปลี่ยนแปลงของไคลเอ็นต์รายอื่น ให้ใส่ค่า ETag ของรายการต้นฉบับ ซึ่งทำได้โดยการระบุค่า ETag ในส่วนหัว HTTP If-Match
หรือรวมแอตทริบิวต์ gd:etag
ของรายการต้นฉบับไว้ในรายการที่อัปเดต หากต้องการระบุค่า ETag ของรายการต้นฉบับ ให้ตรวจสอบแอตทริบิวต์ gd:etag
ขององค์ประกอบ <entry>
สำหรับรายการสื่อ ETag ของสื่ออาจอยู่ในแอตทริบิวต์ gd:etag
ของลิงก์ edit-media
หากต้องการอัปเดตรายการไม่ว่าจะมีการอัปเดตหรือไม่หลังจากที่คุณดึงข้อมูล ให้ใช้ If-Match: *
และอย่าใส่ ETag ดูข้อมูลเพิ่มเติมเกี่ยวกับ ETag ได้ในคู่มืออ้างอิงสำหรับ Google Data API
การอัปเดตข้อมูลเมตาหรือเนื้อหา HTML ของรายการ
หากต้องการอัปเดตข้อมูลเมตาหรือเนื้อหา HTML ของรายการ ให้ส่ง HTTP PUT
ไปยังลิงก์ edit
ของรายการ
ต่อไปนี้เป็นตัวอย่างการอัปเดตรายการ listpage
(แทนด้วยรหัส ENTRY_ID
) ที่มีการเปลี่ยนแปลงดังต่อไปนี้
- มีการแก้ไขชื่อเป็น "เนื้อหาที่อัปเดต"
- เนื้อหา HTML ที่อัปเดต
- ส่วนหัวคอลัมน์แรกของรายการอัปเดตเป็น "เจ้าของ"
- เส้นทาง URL ของหน้าเว็บมีการแก้ไขโดยองค์ประกอบ
<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="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 Sites ให้ดึงข้อมูลรายการก่อน แล้วส่งคำขอ DELETE
ไปยัง URL edit
ของรายการ ซึ่งเป็น URL เดียวกันกับที่ใช้เมื่ออัปเดตข้อมูลเมตาหรือเนื้อหา 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 ของรายการต้นฉบับ คุณระบุค่า ETag ของรายการต้นฉบับได้โดยดูที่แอตทริบิวต์ gd:etag
ขององค์ประกอบ <entry>
หากต้องการลบรายการไม่ว่าจะมีการอัปเดตหรือไม่หลังจากที่คุณดึงข้อมูลมา ให้ใช้ 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 แสดงบทบาทการเข้าถึงของเอนทิตีที่เฉพาะเจาะจง ไม่ว่าจะเป็นผู้ใช้ กลุ่มผู้ใช้ โดเมน หรือการเข้าถึงเริ่มต้น (ซึ่งเป็นเว็บไซต์สาธารณะ) ระบบจะแสดงรายการสำหรับเอนทิตีที่มีสิทธิ์เข้าถึงอย่างชัดแจ้งเท่านั้น โดยจะแสดง 1 รายการสำหรับที่อยู่อีเมลแต่ละรายการในแผง "ผู้ที่มีสิทธิ์เข้าถึง" ในหน้าจอการแชร์ของ UI ของ Google Sites ดังนั้น ระบบจะไม่แสดงผู้ดูแลระบบโดเมน แม้ว่าจะมีสิทธิ์เข้าถึงเว็บไซต์โดยนัยก็ตาม
บทบาท
องค์ประกอบบทบาทแสดงถึงระดับการเข้าถึงที่เอนทิตีสามารถมีได้ องค์ประกอบ gAcl:role
มีค่าที่เป็นไปได้ 4 ค่าดังนี้
- Reader — ผู้มีสิทธิ์อ่าน (เทียบเท่ากับสิทธิ์การเข้าถึงระดับอ่านอย่างเดียว)
- writer — ผู้ทำงานร่วมกัน (เทียบเท่ากับสิทธิ์การอ่าน/เขียน)
- owner — โดยปกติจะเป็นผู้ดูแลระบบของเว็บไซต์ (เทียบเท่ากับสิทธิ์การอ่าน/เขียน)
ขอบเขต
องค์ประกอบขอบเขตแสดงถึงเอนทิตีที่มีระดับการเข้าถึงนี้ องค์ประกอบ gAcl:scope
ที่เป็นไปได้มี 5 ประเภทดังนี้
- user — ค่าที่อยู่อีเมล เช่น "user@gmail.com"
- กลุ่ม — ที่อยู่อีเมลของ Google Group เช่น "group@domain.com"
- โดเมน — ชื่อโดเมนของ G Suite เช่น "domain.com"
- invite — ผู้ใช้ที่ได้รับเชิญให้เข้าร่วมเว็บไซต์ แต่ยังไม่ได้เพิ่มใน ACL สำหรับเว็บไซต์ (ใช้ไม่ได้หากระบุ gdata 1.3 หรือต่ำกว่า)
- ค่าเริ่มต้น — ขอบเขตประเภท "ค่าเริ่มต้น" ที่เป็นไปได้มีเพียง 1 ขอบเขตซึ่งไม่มีค่า (เช่น
<gAcl:scope type="default">
) ขอบเขตนี้ควบคุมการเข้าถึงที่ผู้ใช้มีโดยค่าเริ่มต้นในเว็บไซต์สาธารณะ
หมายเหตุ: โดเมนไม่สามารถตั้งค่า gAcl:role
เป็นสิทธิ์การเข้าถึงระดับ "เจ้าของ" โดเมนจะต้องเป็นผู้อ่านหรือผู้เขียนเท่านั้น
เกี่ยวกับขอบเขต "คําเชิญ"
API จะแสดงผลขอบเขตคำเชิญเมื่อคุณเพิ่มผู้ใช้อย่างน้อย 1 รายลงใน ACL ซึ่งยังไม่มีบัญชี Google API จะแสดง URL ที่มีโทเค็นฝังอยู่ ซึ่งคุณต้องมอบให้กับผู้ใช้ที่ได้รับเชิญเพื่ออนุญาตให้ผู้ใช้ยอมรับคำเชิญ
วิธีคำเชิญนี้จะช่วยให้คุณเชิญผู้ใช้ที่ไม่ใช่ Google ได้โดยไม่ต้องทราบอีเมลที่ต้องการใช้ ตราบใดที่ผู้ใช้คลิก URL คำเชิญที่มีโทเค็นแบบฝัง ผู้ใช้จะลงชื่อสมัครรับสิทธิ์เข้าถึงโดยใช้อีเมลใดก็ได้ที่ต้องการ นอกจากนี้ ผู้ใช้หลายคนอาจจะใช้ URL นี้เพื่อยอมรับคำเชิญได้ ดังนั้น วิธีการนี้อาจเป็นประโยชน์หากเชิญผู้ใช้เพียงกลุ่มเดียวหรือเป็นกลุ่ม
หมายเหตุ: ขอบเขต "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 | ชื่อพื้นที่เว็บของเว็บไซต์ ซึ่งพบใน URL ของเว็บไซต์ (เช่น 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
ไปยัง URI ของฟีด ACL:
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 เพียงส่งคำขอ POST
ไปยังฟีด ACL ของเว็บไซต์
หมายเหตุ: 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 จะแสดงผล URL ที่คุณต้องแจ้งกับผู้ใช้ที่คุณต้องการเชิญ หลังจากที่คลิก URL แล้ว ผู้ใช้จะสามารถเข้าถึงเว็บไซต์ดังกล่าวได้โดยการลงชื่อเข้าใช้ด้วยบัญชีที่มีอยู่หรือสร้างบัญชีใหม่
คำเชิญที่สำเร็จจะแสดง 201 Created
และรายการใหม่ที่มี URL ที่คุณต้องส่งให้กับผู้ใช้
<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 เท่านั้น ไม่สามารถแชร์ไซต์กับ domain1.com เท่านั้น ไซต์ที่ไม่ได้โฮสต์บนโดเมน G Suite (เช่น http://sites.google.com/site/siteB) จะไม่สามารถเชิญโดเมนได้
การแก้ไขสิทธิ์การแชร์
หากต้องการอัปเดตรายการ ACL ให้แก้ไขรายการตามที่จำเป็น และส่งคำขอ HTTP 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>
กำลังนำสิทธิ์การแชร์ออก
หากต้องการนำสิทธิ์ของผู้ใช้รายนี้ออก ให้ส่งคำขอ DELETE
ไปยังลิงก์ edit
เดียวกันกับที่ใช้สำหรับคำขอ PUT
ดังนี้
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 GET
ที่มีส่วนหัว HTTP If-None-Match
ในส่วนหัว ให้ระบุ ETag ของรายการหรือของรายการ ซึ่งดูได้ในแอตทริบิวต์ gd:etag
ขององค์ประกอบ <feed>
หรือองค์ประกอบ <entry>
ตัวอย่างการใช้ฟีดเว็บไซต์มีดังนี้
GET /feeds/site/domainName/myOtherTestSite/ GData-Version: 1.4 If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."
เมื่อเซิร์ฟเวอร์ได้รับคำขอนี้ เซิร์ฟเวอร์จะตรวจสอบว่ารายการที่คุณขอมี ETag เดียวกันกับ ETag ที่คุณระบุหรือไม่ หาก ETag ตรงกัน จะไม่มีการเปลี่ยนแปลงรายการ และเซิร์ฟเวอร์ส่งคืนรหัสสถานะ HTTP 304 Not Modified
หรือรหัสสถานะ HTTP 412 Precodition Failed
รหัสสถานะทั้ง 2 รหัสบ่งชี้ว่ารายการที่คุณดึงข้อมูลไปแล้วเป็นข้อมูลล่าสุด
หาก ETag ไม่ตรงกัน แสดงว่ามีการแก้ไขรายการตั้งแต่ครั้งสุดท้ายที่คุณขอ และเซิร์ฟเวอร์ส่งรายการนั้นคืน
ดูข้อมูลเพิ่มเติมเกี่ยวกับ ETag ได้ในคู่มืออ้างอิงสำหรับ Google Data API
การประมวลผลเป็นกลุ่ม
คำขอแบบกลุ่มช่วยให้ลูกค้าสามารถดำเนินการหลายรายการในคำขอเดียว แทนที่จะส่งทีละคำขอ
เซิร์ฟเวอร์จะดำเนินการเปลี่ยนแปลงที่ขอให้ได้มากที่สุด รวมทั้งข้อมูลสถานะการคืนสินค้าที่คุณสามารถใช้เพื่อประเมินความสำเร็จหรือความล้มเหลวของการดำเนินการแต่ละรายการ ดูรายละเอียดเพิ่มเติมเกี่ยวกับการประมวลผลแบบกลุ่มใน Google Data API ได้ที่การประมวลผลแบบกลุ่มด้วย Google Data API
การดำเนินการทั้งหมดในฟีดกลุ่มจะมีองค์ประกอบ <id> ยกเว้นการดำเนินการแทรก
องค์ประกอบนี้เหมือนกับ URL คำขอที่ปกติแล้วคุณจะใช้เมื่ออัปเดต ลบ หรือค้นหาฟีดเนื้อหา
ตัวอย่างเช่น หากคุณกำลังอัปเดตการแก้ไข ให้ตั้งค่า <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>
ฟีดที่แสดงผลจะมีรายการผลลัพธ์ 1 รายการสำหรับแต่ละการดำเนินการ ดังนี้
<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>