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

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

קהל

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

מסמך זה מיועד למתכנתים שרוצים לכתוב אפליקציות לקוח שיכולות לקיים אינטראקציה עם Google Sites. המאמר מספק סדרה של דוגמאות לאינטראקציות בסיסיות ב-Data 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. (אם ה-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
פרמטר של פידתיאור
domainNamesite או הדומיין של הדומיין שמתארח ב-G Suite (למשל example.com).

התגובה תכיל עדכון עם רשימת אתרים:

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

HTTP/1.1 200 OK

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

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

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

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

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

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

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

הבקשה שלמעלה תגרום ליצירת אתר חדש באמצעות Google 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
פרמטר של פידתיאור
domainNamesite או הדומיין של הדומיין שמתארח ב-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/&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 הנכונה ולציין את האסימון שהתקבל בקטע הרשאות בקשות.

חזרה למעלה

פיד גרסאות

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

https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
פרמטר של פידתיאור
domainNamesite או הדומיין של הדומיין שמתארח ב-G Suite (למשל example.com).
siteNameשם מרחב האינטרנט של האתר; שנמצא בכתובת ה-URL של האתר (למשל, myCoolSite).

כדי למצוא את הקישור לגרסאות קודמות של דף/תגובה/קובץ מצורף/רשימה מסוימים, יש לאחזר תחילה את הרשומה מ- את פיד התוכן באמצעות ה-CONTENT_ENTRY_ID שלו. הרשומה שאוחזרה תכיל <atom:link> אל פיד הגרסה. לדוגמה:

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

דוגמה לבקשה ותגובה:

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

HTTP/1.1 200 OK

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

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

חזרה למעלה

פיד תוכן

מתבצע אחזור של התוכן

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

https://sites.google.com/feeds/content/domainName/siteName
פרמטר של פידתיאור
domainNamesite או הדומיין של הדומיין שמתארח ב-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/&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:

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

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

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

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

<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 בכותרת If-Match של HTTP, או לכלול את המאפיין gd:etag של הרשומה המקורית הרשומה המעודכנת. כדי לקבוע את ערך ה-ETag של הרשומה המקורית, יש לבחון את המאפיין gd:etag של הרכיב <entry>. עבור רשומות מדיה, יכול להיות שה-ETag של המדיה יהיה זמין במאפיין gd:etag של הקישור edit-media.

אם ברצונך לעדכן את הרשומה גם אם מישהו אחר עדכן אותה מאז האחזור שלה, עליך להשתמש ב- If-Match: * ולא כוללים את ה-ETag. למידע נוסף על ETags, אפשר לעיין מדריך העזר בנושא Google Data APIs.

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

כדי לעדכן מטא-נתונים או תוכן HTML של רשומה, יש לשלוח PUT HTTP לקישור 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 בקשה לכתובת האתר 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.

כדי לוודא שלא מוחקים רשומה ששונתה על ידי לקוח אחר מאז שאחזרתם אותה, צריך לכלול כותרת If-Match של HTTP שמכילה את ערך ה-ETag של הרשומה המקורית. אפשר לקבוע את ערך ה-ETag של הרשומה המקורית לפי בדיקת המאפיין gd:etag של הרכיב <entry>.

אם ברצונך למחוק את הרשומה, גם אם מישהו אחר לא עדכן אותה מאז האחזור שלה, עליך להשתמש If-Match: * ולא כוללים את ה-ETag. (במקרה זה, אין צורך לאחזר את הרשומה לפני המחיקה).

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

חזרה למעלה



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

ברגע שתהיה לכם רשומת קובץ מצורף, אתם יכולים להוריד את הקובץ על ידי שליחת כתובת HTTP מאומתת GET קישור לדף <content>. דוגמה לקישור תוכן של קובץ 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 – צופה (שווה להרשאת קריאה בלבד).
  • author – שותף עריכה (מקביל לגישת קריאה/כתיבה).
  • 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 מוגדר כ'בעלים' הם יכולים להיות רק קוראים או כותבים.

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

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

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

הערה: הקטע 'הזמנה' היקף ההרשאות הזה זמין רק ב-gdata בגרסה 1.4 ואילך. השיטה הזו לא תפעל אם ציינת באופן מפורש את הגרסה 1.3 ומטה.

אחזור פיד ה-ACL

ניתן להשתמש בפיד ה-ACL כדי לשלוט בהרשאות השיתוף של אתר, וניתן לגשת אליו דרך ה-URI הבא:

https://sites.google.com/feeds/acl/site/domainName/siteName
פרמטר של פידתיאור
domainNamesite או הדומיין של הדומיין שמתארח ב-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"/>

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

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

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

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

עיבוד באצווה

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

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

כל פעולה בפיד באצווה כוללת רכיב &lt;id&gt;, מלבד פעולות הוספה. הרכיב הזה זהה לכתובת ה-URL של הבקשה שבה בדרך כלל משתמשים כדי לעדכן, למחוק או לשלוח שאילתות לגבי פיד התוכן. לדוגמה, אם מעדכנים שינוי עריכה, מגדירים את &lt;id&gt; כקישור edit עבור הרשומה הרלוונטית. הוא משמש לזיהוי רשומת היעד. רשומות חדשות לא כוללות רכיבי &lt;id&gt; כי עדיין לא נוצרו. במקום זאת, אפשר להגדיר ערך מחרוזת ב-&lt;batch:id&gt;, שיהיה שהוחזרו בתגובה של השרת ומשמשים לחיפוש הרשומה המתאימה.

כדי לשלוח בקשה באצווה, צריך ליצור פיד ברצף ולשלוח POST HTTP לקישור לאצוות של הפיד:

<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>

חזרה למעלה