Calendars: update

עדכון מטא-נתונים של יומן. אפשר לנסות עכשיו או לראות דוגמה.

בקשה

בקשת HTTP

PUT https://www.googleapis.com/calendar/v3/calendars/calendarId

פרמטרים

שם הפרמטר Value התיאור
פרמטרים של נתיב
calendarId string מזהה היומן. כדי לאחזר מזהי יומנים, צריך לקרוא לשיטה calendarList.list. כדי לגשת ליומן הראשי של המשתמש שמחובר כרגע, צריך להשתמש במילת המפתח "primary".

הרשאות

בקשה זו מחייבת הרשאה בהיקף הבא:

היקף
https://www.googleapis.com/auth/calendar

מידע נוסף זמין בדף אימות והרשאה.

גוף הבקשה

בגוף הבקשה, מספקים משאב יומנים עם המאפיינים הבאים:

שם הנכס Value התיאור הערות
מאפיינים אופציונליים
description string תיאור היומן. אפשרות. ניתן לכתיבה
location string המיקום הגיאוגרפי של היומן כטקסט חופשי. אפשרות. ניתן לכתיבה
summary string שם היומן. ניתן לכתיבה
timeZone string אזור הזמן של היומן. (בפורמט של שם מסד נתונים של אזור זמן IANA, לדוגמה "אירופה/ציריך"). אפשרות. ניתן לכתיבה

תשובה

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

דוגמאות

הערה: דוגמאות הקוד הזמינות לשיטה זו לא מייצגות את כל שפות התכנות הנתמכות (רשימת השפות הנתמכות זמינה בדף של ספריות המשתמשים).

Java

משתמש בספריית הלקוח של Java.

import com.google.api.services.calendar.Calendar;

// ...

// Initialize Calendar service with valid OAuth credentials
Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
    .setApplicationName("applicationName").build();

// Retrieve a calendar
com.google.api.services.calendar.model.Calendar calendar =
    service.calendars().get('primary').execute();

// Make a change
calendar.setSummary("calendarSummary");

// Update the altered calendar
com.google.api.services.calendar.model.Calendar updatedCalendar =
    service.calendars().update(calendar.getId(), calendar).execute();

System.out.println(updatedCalendar.getEtag());

Python

עושה שימוש בספריית הלקוח של Python.

# First retrieve the calendar from the API.
calendar = service.calendars().get(calendarId='primary').execute()

calendar['summary'] = 'New Summary'

updated_calendar = service.calendars().update(calendarId=calendar['id'], body=calendar).execute()

print updated_calendar['etag']

PHP

נעשה שימוש בספריית הלקוח של PHP.

// First retrieve the calendar from the API.
$calendar = $service->calendars->get('primary');

$calendar->setSummary('New Summary');

$updatedCalendar = $service->calendars->update('primary', $calendar);

echo $updatedCalendar->getEtag();

Ruby

נעשה שימוש בספריית הלקוח של Ruby.

calendar = client.get_calendar('primary')
calendar.summary = "New Summary"
result = client.update_calendar(calendar.id, calendar)
print result.etag

רוצה לנסות?

ניתן להשתמש ב-APIs Explorer שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה.