עדכון יומן קיים ברשימת היומנים של המשתמש. אפשר לנסות עכשיו או לראות דוגמה.
בקשה
בקשת HTTP
PUT https://www.googleapis.com/calendar/v3/users/me/calendarList/calendarId
פרמטרים
שם הפרמטר | Value | התיאור |
---|---|---|
פרמטרים של נתיב | ||
calendarId |
string |
מזהה היומן. כדי לאחזר מזהי יומנים, צריך לקרוא לשיטה calendarList.list. כדי לגשת ליומן הראשי של המשתמש שמחובר כרגע, צריך להשתמש במילת המפתח "primary ".
|
פרמטרים אופציונליים של שאילתה | ||
colorRgbFormat |
boolean |
האם להשתמש בשדות foregroundColor ו-backgroundColor כדי לכתוב את צבעי היומן (RGB). אם נעשה שימוש בתכונה הזו, הערך בשדה colorId שמבוסס על אינדקס יוגדר באופן אוטומטי לאפשרות ההתאמה הטובה ביותר. אפשרות. ברירת המחדל היא False.
|
הרשאות
בקשה זו מחייבת הרשאה בהיקף הבא:
היקף |
---|
https://www.googleapis.com/auth/calendar |
מידע נוסף זמין בדף אימות והרשאה.
גוף הבקשה
בגוף הבקשה, מספקים משאב CalendarList עם המאפיינים הבאים:
שם הנכס | Value | התיאור | הערות |
---|---|---|---|
מאפיינים אופציונליים | |||
backgroundColor |
string |
הצבע הראשי של היומן בפורמט ההקסדצימלי "#0088aa ". המאפיין הזה מחליף את המאפיין colorId שמבוסס על אינדקס. כדי להגדיר או לשנות את המאפיין הזה, צריך לציין colorRgbFormat=true בפרמטרים של השיטות insert, update ו-תיקון. אפשרות. |
ניתן לכתיבה |
colorId |
string |
צבע היומן. זהו מזהה שמפנה לרשומה בקטע calendar של הגדרת הצבעים (אפשר לעיין בנקודת הקצה של הצבעים). המאפיין הזה מוחלף במאפיינים backgroundColor ו-foregroundColor , וניתן להתעלם ממנו כשמשתמשים במאפיינים האלה. אפשרות. |
ניתן לכתיבה |
defaultReminders[] |
list |
תזכורות ברירת המחדל שיש למשתמש המאומת עבור היומן הזה. | ניתן לכתיבה |
defaultReminders[].method |
string |
השיטה שבה נעשה שימוש בתזכורת הזו. הערכים האפשריים הם:
חובה כשמוסיפים תזכורת. |
ניתן לכתיבה |
defaultReminders[].minutes |
integer |
מספר הדקות לפני תחילת האירוע שבהן התזכורת צריכה להתחיל. הערכים החוקיים הם בין 0 ל-40320 (4 שבועות בדקות). חובה כשמוסיפים תזכורת. |
ניתן לכתיבה |
foregroundColor |
string |
הצבע הקדמי של היומן בפורמט ההקסדצימלי '#ffffff '. המאפיין הזה מחליף את המאפיין colorId שמבוסס על אינדקס. כדי להגדיר או לשנות את המאפיין הזה, צריך לציין colorRgbFormat=true בפרמטרים של השיטות insert, update ו-תיקון. אפשרות. |
ניתן לכתיבה |
notificationSettings |
object |
ההתראות שהמשתמש המאומת מקבל עבור היומן הזה. | ניתן לכתיבה |
notificationSettings.notifications[].method |
string |
השיטה ששימשה להעברת ההתראה. הערך האפשרי הוא:
חובה כשמוסיפים תזכורת. |
ניתן לכתיבה |
notificationSettings.notifications[].type |
string |
סוג ההתראה. הערכים האפשריים הם:
חובה כשמוסיפים תזכורת. |
ניתן לכתיבה |
selected |
boolean |
האם תוכן היומן מופיע בממשק המשתמש של היומן. אפשרות. ברירת המחדל היא False. | ניתן לכתיבה |
summaryOverride |
string |
הסיכום שהמשתמש המאומת הגדיר עבור היומן הזה. אפשרות. | ניתן לכתיבה |
תשובה
אם הפעולה בוצעה ללא שגיאות, השיטה הזו תחזיר משאב CalendarList בגוף התגובה.
דוגמאות
הערה: דוגמאות הקוד הזמינות לשיטה זו לא מייצגות את כל שפות התכנות הנתמכות (רשימת השפות הנתמכות זמינה בדף של ספריות המשתמשים).
Java
משתמש בספריית הלקוח של Java.
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.CalendarListEntry; // ... // Initialize Calendar service with valid OAuth credentials Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials) .setApplicationName("applicationName").build(); // Retrieve the calendar list entry CalendarListEntry calendarListEntry = service.calendarList().get("calendarId").execute(); // Make a change calendarListEntry.setColorId("newColorId"); // Update the altered entry CalendarListEntry updatedCalendarListEntry = service.calendarList().update(calendarListEntry.getId(), calendarListEntry).execute(); System.out.println(updatedCalendarListEntry.getEtag());
Python
עושה שימוש בספריית הלקוח של Python.
# First retrieve the calendarListEntry from the API. calendar_list_entry = service.calendarList().get(calendarId='calendarId').execute() calendar_list_entry['colorId'] = 'newColorId' updated_calendar_list_entry = service.calendarList().update( calendarId=calendar_list_entry['id'], body=calendar_list_entry).execute() print created_calendar_list_entry['etag']
PHP
נעשה שימוש בספריית הלקוח של PHP.
// First retrieve the calendarListEntry from the API. $calendarListEntry = $service->calendarList->get('calendarId'); $calendarListEntry->setColorId('newColorId'); $updatedCalendarListEntry = service->calendarList->update($calendarListEntry->getId(), $calendarListEntry); echo $updatedCalendarListEntry->getEtag();
Ruby
נעשה שימוש בספריית הלקוח של Ruby.
calendar_list_entry = client.get_calendar_list('calendarId') calendar_list_entry.colorId = 'newColorId' result = client.update_calendar_list(calendar_list_entry.id, calendar_list_entry) print result.etag
רוצה לנסות?
ניתן להשתמש ב-APIs Explorer שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה.