מדריך לפרוטוקול

הממשק הקלאסי של Google Sites API מאפשר לאפליקציות שלך לגשת לתוכן בתוך אתר שנוצר באמצעות Google Sites, לפרסם ולשנות אותו. בנוסף, האפליקציה שלך יכולה לבקש רשימה של פעילויות אחרונות, לאחזר היסטוריית גרסאות ולהעלות/להוריד קבצים מצורפים וקבצים.

קהל

במסמך זה אנחנו מניחים שאתם מבינים את הרעיונות הכלליים שמאחורי פרוטוקול Google Data APIs.

המסמך הזה מיועד למתכנתים שרוצים לכתוב אפליקציות לקוח שיכולות לקיים אינטראקציה עם Google Sites. היא מספקת סדרה של דוגמאות לאינטראקציות בסיסיות ב-API של נתונים באמצעות XML/HTTP גולמיים, עם הסברים. אחרי שתקראו את המסמך הזה, תוכלו לקרוא מידע נוסף על האינטראקציה עם ה-API באמצעות ספריות הלקוח שלנו באמצעות הדוגמאות לשפות ספציפיות במדריכים האחרים שבסרגל הניווט הימני.

לעיון בחומר המפורט במדריך זה, עיין במדריך העזר.

הרשאת בקשות

כשהאפליקציה מבקשת נתוני משתמש שאינם ציבוריים, היא חייבת לכלול אסימון הרשאה. אסימון ההרשאה גם מזהה את האפליקציה שלכם ב-Google.

הסבר על פרוטוקולים של הרשאות

כדי לאשר בקשות, האפליקציה חייבת להשתמש בפרוטוקול OAuth 2.0. אין תמיכה בפרוטוקולים אחרים של הרשאות. אם האפליקציה משתמשת בכניסה באמצעות חשבון Google, היבטים מסוימים של ההרשאות מטופלים באופן אוטומטי.

הרשאת בקשות עם פרוטוקול OAuth 2.0

בקשות ל-Google Sites Data API עבור נתוני משתמשים שאינם ציבוריים חייבות להיות מאושרות על ידי משתמש מאומת.

הפרטים או ה"זרימה" של תהליך ההרשאה עם OAuth 2.0 עשויים להשתנות מעט, בהתאם לסוג האפליקציה שאתם מפתחים. התהליך הכללי הבא חל על כל סוגי האפליקציות:

  1. כשאתם יוצרים את האפליקציה, צריך לרשום אותה באמצעות Google API Console. לאחר הרישום, Google מספקת נתונים שיהיו דרושים לכם מאוחר יותר, כמו מזהה לקוח וסוד לקוח.
  2. הפעל את Google Sites Data API ב-Google API Console. (אם ממשק ה-API לא מופיע ב-API Console, אפשר לדלג על השלב הזה).
  3. כשהאפליקציה צריכה גישה לנתונים של משתמשים, היא מעבירה ל-Google בקשת גישה בהיקף ספציפי.
  4. Google מציגה למשתמש מסך הסכמה ומבקשת לאשר לאפליקציה לשלוח בקשה לחלק מהנתונים שלו.
  5. אם המשתמש מסכים, האפליקציה מקבלת מ-Google אסימון גישה לטווח קצר.
  6. האפליקציה מבקשת את נתוני המשתמש ומצרפת לבקשה את אסימון הגישה.
  7. אם 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/&quot;CkUAQH4_eil7I2A9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/site/myTestSite</id>
  <updated>2009-12-01T01:17:21.042Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T01:17:21.042Z</app:edited>
  <title>myTestSite</title>
  <summary/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myTestSite/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/>
  <sites:siteName>myTestSite</sites:siteName>
  <sites:theme>default</sites:theme>
</entry>
<entry gd:etag="W/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Memories Site"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <sites:siteName>myOtherTestSite</sites:siteName>
  <sites:theme>iceberg</sites:theme>
</entry>
...
</feed>

האתרים מסודרים לפי סדר אלפביתי.

יצירת אתרים חדשים

הערה: התכונה הזו זמינה רק בדומיינים של G Suite.

ניתן להקצות אתרים חדשים על ידי יצירת POST HTTP אל פיד האתר, לדוגמה:

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 עם העיצוב 'שקופית' במסגרת הדומיין example.com ב-G Suite. כתובת האתר תהיה http://sites.google.com/a/example.com/source-site/.

אם האתר נוצר בהצלחה, השרת יגיב באמצעות 201 Created. רשומת התגובה תכיל רכיבים שנוספו על ידי השרת, כמו קישור לאתר, קישור לעדכון ה-ACL של האתר, שם האתר, הכותרת והסיכום.

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

העתקת אתר

הערה: התכונה הזו זמינה רק בדומיינים של G Suite.

אפשר לשכפל אתר קיים בדיוק כמו שיוצרים אתר חדש. עם זאת, ברשומת ה-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/&quot;DEECR38l7I2A9WxNaF0Q.&quot;">
  <id>https://sites.google.com/feeds/site/example.com/source-site</id>
  <updated>2009-12-02T23:31:06.184Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
  <title>New Test Site2</title>
  <summary>Newer description</summary>
  <category scheme="http://schemas.google.com/sites/2008#tag" term="Category"/>
  <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
  <sites:siteName>source-site</sites:siteName>
</entry>

הוספת קטגוריות

הערה: התכונה הזו זמינה רק בדומיינים של G Suite.

חבילת G Suite לאתרים בדומיין שלך כוללת מטא נתונים של קטגוריות, שבעזרתן אפשר לסווג אתרים בתוך הדומיין. כדי להוסיף או לעדכן מטא נתונים של קטגוריה, צריך לשלוח HTTP PUT לקישור edit של רשומת האתר שכולל את התג category. בדוגמה הבאה אפשר לראות את השורה המודגשת:

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

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

בדוגמה הבאה מתבצעת עריכה של אתר קיים והוספה של הקטגוריה 'אתר צוות'.

אפשר גם להוסיף מספר קטגוריות על ידי הוספת תגי <category>. בדוגמה הבאה אפשר לראות את השורות המודגשות:

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

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

דוגמה זו מוסיפה שתי קטגוריות: 'אתר צוות' ו'מחלקה משפטית'

מיפויים של כתובות אינטרנט

מיפויים של כתובות אינטרנט מאפשרים למשתמשי Google 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/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='http://www.mysitemapping.com'>
  <link rel='webAddressMapping' href='http://www.mysitemapping2.com'>
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>
...
</feed>

מיפויים קיימים יוצגו כ-link עם rel='webAddressMapping'. לדוגמה, בדוגמה שלמעלה יש שלושה סימני webAddressMapping שמפנות לאתר http://sites.google.com/site/myOtherTestSite.

שינוי מיפויים של כתובות אינטרנט

הערה: בכל הפעולות של GET/POST/PUT צריך לציין את הפרמטר with-mappings=true כשעובדים עם מיפויים של כתובות אינטרנט. אם הפרמטר חסר, ערכי 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/&quot;DkQGQHczfA9WxNaFk4.&quot;">
  <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id>
  <updated>2009-12-01T02:25:21.987Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited>
  <title>myOtherTestSite</title>
  <summary>A new site to hold memories</summary>
  <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/>
  <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
      href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/>
  <link rel='webAddressMapping' href='www.my-new-sitemapping.com'>
  <!-- missing mapping2 will be deleted -->
  <link rel='webAddressMapping' href='http://www.myothermapping.org'>
</entry>

הערה: אפשר לציין מיפויים של כתובות אינטרנט גם בזמן היצירה/העתקה של האתר.

חזרה למעלה

פיד הפעילות

כדי לאחזר את הפעילות האחרונה (שינויים) באתר, אפשר לאחזר את פיד הפעילות. כל רשומה בפיד הפעילות מכילה מידע על שינוי שבוצע באתר.

כדי לשלוח שאילתה לגבי פיד הפעילות, צריך לשלוח HTTP GET לכתובת ה-URL של פיד הפעילות:

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/&quot;CU4GQ3szfSl7ImA9WxNRFUg.&quot;">
<id>https://sites.google.com/feeds/activity/site/siteName/940375996952876062</id>
<updated>2009-09-10T03:38:42.585Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#deletion" label="deletion"/>
<title>home</title>
<summary type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">User deleted <a href="http://sites.google.com/site/siteName/home">home</a>
</div>
</summary>
<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
  href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
<link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
  href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
<link rel="self" type="application/atom+xml"
  href="https://sites.google.com/feeds/activity/site/siteName/940375996952876062"/>
<author>
  <name>User</name>
  <email>user@gmail.com</email>
</author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8DQn45fyl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/7165439066235480082</id>
  <updated>2009-09-10T03:37:53.027Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#edit" label="edit"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User2 edited <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/7165439066235480082"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
</entry>
<entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8AR3s4cSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/activity/site/siteName/127448462987345884</id>
  <updated>2009-09-10T03:37:26.539Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/sites/2008#creation" label="creation"/>
  <title>home</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">User3 created <a href="http://sites.google.com/site/siteName/home">home</a>
  </div>
  </summary>
  <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/>
  <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml"
    href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/activity/site/siteName/127448462987345884"/>
  <author>
    <name>User3</name>
    <email>user3@gmail.com</email>
  </author>
</entry>
</feed>

הערה: כדי לגשת אל הפיד הזה, אתם צריכים להיות שותפי עריכה או בעלים של האתר. עליכם לשלוח את הכותרת Authorization הנכונה ולהפנות לאסימון שהתקבל במהלך Authorization requests.

חזרה למעלה

פיד גרסאות קודמות

כדי לאחזר את היסטוריית הגרסאות של ערך תוכן כלשהו, שולחים HTTP GET לקישור הגרסה הקודמת של הרשומה:

https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
פרמטר פידתיאור
domainName'site' או הדומיין של הדומיין המתארח ב-G Suite (למשל example.com).
siteNameשם מרחב האינטרנט של האתר שלך; מופיע בכתובת של האתר (למשל 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/&quot;CU4GQmA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2</id>
  <updated>2009-09-10T03:38:42.045Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Latest content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4f67c7&amp;rev1=2"/>
  <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>2</sites:revision>
</entry>
<entry gd:etag="W/&quot;CU8DQ388eSl7ImA9WxNRFUg.&quot;">
  <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1</id>
  <updated>2009-09-10T03:37:52.171Z</updated>
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
  <title>Home</title>
  <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">Older content here</div>
  </content>
  <link rel="alternate" type="text/html"
    href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4bc7&amp;rev1=1"/>
  <link rel="self" type="application/atom+xml"
    href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1"/>
  <author>
    <name>User</name>
    <email>user@gmail.com</email>
  </author>
  <sites:pageName>home</sites:pageName>
  <sites:revision>1</sites:revision>
</entry>
</feed>

הערה: כדי לגשת אל הפיד הזה, אתם צריכים להיות שותפי עריכה או בעלים של האתר. הלקוח צריך לשלוח את הכותרת Authorization הנכונה ולהפנות לאסימון שהתקבל בהרשאות בקשות.

חזרה למעלה

פיד תוכן

המערכת מאחזרת תוכן

פיד התוכן מציג את התוכן הנוכחי של אתר. צריך לשלוח בקשת GET מאומתת לכתובת ה-URL הבאה:

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 הנכונה (כפי שאפשר לראות בדוגמה שלמעלה) ולהפנות לאסימון שהתקבל בקטע Authorizing requests (בקשות הרשאה).

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

HTTP/1.1 200 OK

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

הערה: אלה התוצאות הראשונות בלבד. כדי לדפדף בפיד התוכן כולו, לחצו על הקישור 'הבא' בפיד:

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

להסבר על הרכיבים הנפוצים ב-Atom, אפשר לעיין בחומר העזר בנושא פרוטוקולי נתונים של Google. בהמשך מתוארים רכיבים שכוללים מדידה ספציפית של 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, ואלה הספציפיים לממשק ה-API הקלאסי של Google Sites. למידע מפורט יותר ורשימה מלאה של הפרמטרים הנתמכים, עיינו במדריך העזר.

אחזור סוגים ספציפיים של רשומות

כדי לאחזר רק סוג מסוים של רשומה, צריך להשתמש בפרמטר kind. הדוגמה הזו מחזירה רק webpage רשומות:

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

כדי להחזיר יותר מסוג רשומה אחד, צריך להפריד כל 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

חזרה למעלה



יצירת תוכן

אפשר ליצור תוכן חדש (דפי אינטרנט, דפי רשימה, דפי ארון קבצים, דפי הודעות וכו') על ידי שליחת POST HTTP אל פיד התוכן:

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 ועותק של הרשומה.

יצירת פריטים/דפים בנתיבים של כתובות URL מותאמות אישית

כברירת מחדל, הדוגמה הקודמת תיווצר תחת כתובת ה-URL http://sites.google.com/domainName/siteName/new-webpage-title, והכותרת של הדף תהיה '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 של דף:

  1. <sites:pageName>, אם יש כזה. חייב לעמוד ב-a-z, A-Z, 0-9, -, _.
  2. <atom:title>, לא יכול להיות null אם לא קיים pageName. באמצעות נורמליזציה, תצטרכו לחתוך ולכווץ את הרווח הלבן לערך '-' ולהסיר תווים שלא תואמים לערך a-z, A-Z, 0-9, -, _.

כדוגמה, השרת 'Custom_Page2' יתקבל.

יצירת דפי משנה

כדי ליצור דפי משנה (ילדים) בדף הורה, צריך לכלול <link rel="http://schemas.google.com/sites/2008#parent"> ברשומת ה-Atom החדשה. צריך להגדיר את מאפיין href של הקישור כקישור העצמי של רשומת ההורה.

בדוגמה הזו נוצר announcement חדש עם הכותרת 'הודעה', מתחת לדף הודעות להורים עם מזהה הערך PARENT_ENTRY_ID. תוכן XHTML לגוף הדף נכלל גם:

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

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

תבניות של דפים

יצירת תבניות של דפים

תהליך היצירה של תבנית דף זהה לתהליך היצירה של יצירת פריטים/דפים חדשים ויצירת דפי משנה.ההבדל הוא שההבדל הוא הוספה של category עם מונח ותווית שמוגדרים ל-'http://schemas.google.com/g/2005#template' ו-'template', בהתאמה.

הדוגמה הזו יוצרת תבנית 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 Sites, ממשק ה-API מאפשר להעלות קבצים מצורפים לדפים של ספריות קבצים ולדפי הורה.

כדי להעלות קובץ מצורף להורה, צריך לשלוח בקשת HTTP מסוג POST לכתובת ה-URL של פיד התוכן:

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

הגוף של POST צריך להיות בקשה מרובת חלקים מסוג MIME, כדי לשלב את תוכן הקובץ עם <atom:entry> שמכיל את המטא-נתונים של הקובץ המצורף. השדה <atom:entry> צריך להפנות לקישור העצמי של הרשומה ברמה העליונה, כדי לציין איפה הקובץ המצורף ייווצר. מידע נוסף זמין ביצירת דפי משנה.

הקבצים מועלים

הנה דוגמה להעלאת קובץ PDF לספריית קבצים עם המזהה PARENT_ENTRY_ID. הקובץ המצורף ייווצר עם הכותרת 'קובץ PDF' ותיאור (אופציונלי) 'חבילת משאבי אנוש'.

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' בממשק המשתמש של 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'.

חזרה למעלה



עדכון התוכן

ניתן לערוך את המטא נתונים (כותרת, שם דף וכו') ואת תוכן הדף של כל דף באמצעות בקשת 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. במדריך העזר ל-Google Data APIs תוכלו לקרוא מידע נוסף על תגים מסוג ETags.

עדכון מטא-נתונים או תוכן HTML של פריט

כדי לעדכן את המטא-נתונים או את תוכן ה-HTML של רשומה, צריך לשלוח HTTP PUT לקישור ה-edit של הרשומה.

זוהי דוגמה לעדכון של ערך listpage (המיוצג על ידי המזהה שלו ENTRY_ID) עם השינויים הבאים:

  • הכותרת השתנתה ל 'תוכן מעודכן'
  • תוכן HTML מעודכן
  • כותרת העמודה הראשונה ברשימה מעודכנת ל 'בעלים'
  • הרכיב <sites:pageName> משנה את נתיב כתובת ה-URL של הדף
PUT /feeds/content/domainName/siteName/ENTRY_ID
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 816
Content-Type: application/atom+xml

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

הערה: הרשומה (כפי שמוחזר על ידי השרת) תכלול יותר רכיבים מהדוגמה שלמעלה.

החלפת תוכן של קובץ מצורף

לפניכם דוגמה להחלפת התוכן של קובץ מצורף, אך השארת המטא-נתונים שלו ללא שינוי. הבקשה מכילה תוכן חדש, ולכן נעשה שימוש בקישור edit-media של הרשומה בקובץ המצורף.

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

... doc contents here ...

עדכון המטא-נתונים והתוכן של הקבצים המצורפים

למטה מוצגת דוגמה לעדכון המטא-נתונים של קובץ מצורף והתוכן שלו בו-זמנית. הקבצים המצורפים יעודכנו ל-'New Title' והתוכן שלהם יוחלף בתוכן של קובץ ZIP. הבקשה מכילה תוכן חדש של הקובץ, ולכן נעשה שימוש בקישור edit-media של הרשומה המצורפת.

שימו לב שהכללה של ה-ETag למטא-נתונים מספקת If-Match מרומז גם לתוכן המדיה, כי כל עדכון של תוכן המדיה גורם לשינוי ה-ETag של המטא-נתונים.

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

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

--END_OF_PART
Content-Type: application/zip

... zip contents here ...

--END_OF_PART

חזרה למעלה



מחיקת תוכן

כדי להסיר פריט מאתר שנוצר באמצעות Google 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. (במקרה כזה, אין צורך לאחזר את הרשומה לפני המחיקה).

מידע נוסף על תגי ETags זמין במדריך העזר של Google Data APIs.

חזרה למעלה



מתבצעת הורדה של קבצים מצורפים

ברגע שיש לכם רשומה של קובץ מצורף, אפשר להוריד את הקובץ על ידי שליחת 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 Sites. לכן מנהלי דומיינים לא יוצגו, גם אם יש להם גישה מרומזת לאתר.

תפקידים

רכיב התפקיד מייצג רמת גישה שיכולה להיות לישות. יש ארבעה ערכים אפשריים של הרכיב gAcl:role:

  • Reader — צופה (שווה לגישת קריאה בלבד).
  • writer — שותף עריכה (שווה ערך לגישת קריאה/כתיבה).
  • owner – בדרך כלל מנהל האתר (שווה לגישת קריאה/כתיבה).

רמות

רכיב ההיקף מייצג את הישות שיש לה את רמת הגישה הזו. יש חמישה סוגים אפשריים של הרכיב gAcl:scope:

  • user - ערך של כתובת אימייל, למשל "user@gmail.com".
  • group — כתובת אימייל של קבוצת Google, למשל "group@domain.com".
  • domain - שם דומיין ב-G Suite, לדוגמה "domain.com".
  • preorder - משתמש שהוזמן לאתר, אך עדיין לא נוסף לרשימת ה-ACL של האתר. (לא זמין אם צוין gdata 1.3 ומטה).
  • default – יש רק היקף אחד אפשרי מסוג "default" (ברירת מחדל) שאין לו ערך (למשל <gAcl:scope type="default">). ההיקף הספציפי הזה קובע את הגישה של כל משתמש באתר ציבורי כברירת מחדל.

הערה: בדומיינים לא ניתן להגדיר את הערך gAcl:role כגישת בעלים, אלא רק קוראים או כותבים.

מידע על ההיקף 'הזמנה'.

ממשק ה-API מחזיר את היקף ההזמנה כשמוסיפים משתמש אחד או יותר לרשימת ה-ACL שאין להם עדיין חשבון Google. ה-API מחזיר כתובת URL עם אסימון מוטמע שצריך לספק למשתמשים שהוזמנו כדי לאפשר להם לאשר את ההזמנה.

שיטת הזמנה זו מאפשרת לך להזמין משתמשים שאינם משתמשי Google, ללא ידיעתו מראש לגבי כתובת האימייל שבה הם רוצים להשתמש. כל עוד משתמשים ילחצו על כתובת ה-URL של ההזמנה עם האסימון המוטמע, הם יוכלו להירשם לקבלת גישה באמצעות כל כתובת אימייל שירצו. בנוסף, מספר משתמשים יכולים להשתמש בכתובת האתר הזו כדי לאשר את ההזמנה, כך שזוהי אפשרות שימושית כאשר מזמינים משתמש אחד או קבוצה של משתמשים.

הערה: ההיקף 'הזמנה' זמין רק ב-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"/>

כדי לאחזר את הרשאות השיתוף של אתר, צריך לשלוח GET ו-HTTP ל-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 שצריך לספק למשתמשים שרוצים להזמין. לאחר לחיצה על כתובת האתר, הם יוכלו לקבל גישה לאתר על ידי כניסה באמצעות חשבון קיים, או יצירת חשבון חדש.

הזמנה מוצלחת מחזירה 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, ולא עם domain2.com. אתרים שאינם מתארחים בדומיין G Suite (למשל http://sites.google.com/site/siteB) לא יכולים להזמין דומיינים.

שינוי הרשאות השיתוף

כדי לעדכן רשומת ACL, יש לשנות אותה לפי הצורך ולשלוח בקשת HTTP PUT לקישור edit של הרשומה, שהוא פשוט רכיב <link>, שהמאפיין rel (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 שכוללת כותרת If-None-Match של HTTP. בכותרת, מציינים את ה-ETag של הרשימה או הרשומה. את התג אפשר למצוא במאפיין gd:etag של הרכיב <feed> או של הרכיב <entry>.

דוגמה לשימוש בפיד האתר:

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

כשהשרת מקבל את הבקשה הזו, הוא בודק אם לפריט שביקשתם יש אותו ETag כמו ל-ETag שציינתם. אם תגי ה-ETags תואמים, הפריט לא השתנה והשרת מחזיר קוד סטטוס Not Modified של HTTP 304 או קוד מצב HTTP 412 Precodition Failed. שני קודי הסטטוס האלה מציינים שהפריט שכבר אחזרת עדכני.

אם תגי ה-ETags לא תואמים, הפריט השתנה מאז הפעם האחרונה שביקשת אותו והשרת מחזיר את הפריט.

מידע נוסף על תגי ETags זמין במדריך העזר של Google Data APIs.

עיבוד באצווה

בקשות אצווה מאפשרות ללקוח לבצע פעולות מרובות בבקשה אחת, במקום לשלוח כל פעולה בנפרד.

השרת יבצע כמה שיותר מהשינויים המבוקשים ויחזיר פרטי סטטוס שבהם תוכלו להיעזר כדי להעריך את ההצלחה או הכשל של כל פעולה. לפרטים נוספים על עיבוד ברצף ב-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="&quot;YDgpeyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
    <batch:operation type='update'/>
    <category scheme="http://schemas.google.com/g/2005#kind"
        term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
    <title>Updated Title for Webpage2</title>
    ...
    <batch:operaation type="update"/>
  </entry>
  <entry gd:etag="&quot;YassseyI.&quot;">
    <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
    <batch:operation type='delete'/>
  </entry>
</feed>

הפיד שמוחזר יכלול רשומת תוצאה אחת לכל פעולה:

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

חזרה למעלה