Events: watch
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مراقب تغییرات در منابع رویدادها باشید.
درخواست کنید
درخواست HTTP
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch
پارامترها
نام پارامتر | ارزش | توضیحات |
---|
پارامترهای مسیر |
calendarId | string | شناسه تقویم برای بازیابی شناسه های تقویم با روش calendarList.list تماس بگیرید. اگر میخواهید به تقویم اصلی کاربر وارد شده در حال حاضر دسترسی داشته باشید، از کلمه کلیدی " primary " استفاده کنید. |
پارامترهای پرس و جو اختیاری |
eventTypes | string | انواع رویداد از منابع برای تماشا. اختیاری. این پارامتر می تواند چندین بار برای تماشای منابع از انواع مختلف تکرار شود. اگر تنظیم نشود، همه انواع رویداد را برمیگرداند.
مقادیر قابل قبول عبارتند از:- "
birthday ": رویدادهای ویژه تمام روز با تکرار سالانه. - "
default ": رویدادهای منظم. - "
focusTime ": روی رویدادهای زمانی تمرکز کنید. - "
fromGmail ": رویدادهایی از Gmail. - "
outOfOffice ": رویدادهای خارج از دفتر. - "
workingLocation ": رویدادهای محل کار.
|
مجوز
این درخواست اجازه مجوز با حداقل یکی از حوزه های زیر را می دهد:
دامنه |
---|
https://www.googleapis.com/auth/calendar.readonly |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.events.readonly |
https://www.googleapis.com/auth/calendar.events |
https://www.googleapis.com/auth/calendar.app.created |
https://www.googleapis.com/auth/calendar.events.freebusy |
https://www.googleapis.com/auth/calendar.events.owned |
https://www.googleapis.com/auth/calendar.events.owned.readonly |
https://www.googleapis.com/auth/calendar.events.public.readonly |
برای اطلاعات بیشتر، به صفحه احراز هویت و مجوز مراجعه کنید.
درخواست بدن
در بدنه درخواست، داده ها را با ساختار زیر ارائه دهید:
{
"id": string,
"token": string,
"type": string,
"address": string,
"params": {
"ttl": string
}
}
نام ملک | ارزش | توضیحات | یادداشت ها |
---|
id | string | یک UUID یا یک رشته منحصر به فرد مشابه که این کانال را شناسایی می کند. | |
token | string | یک رشته دلخواه با هر اعلان از طریق این کانال به آدرس مورد نظر تحویل داده می شود. اختیاری. | |
type | string | نوع مکانیزم تحویل مورد استفاده برای این کانال. مقادیر معتبر " web_hook " (یا " webhook ") هستند. هر دو مقدار به کانالی اشاره دارد که در آن از درخواست های Http برای ارسال پیام استفاده می شود. | |
address | string | آدرسی که اعلانهای این کانال در آن ارسال میشود. | |
params | object | پارامترهای اضافی کنترل کننده رفتار کانال تحویل اختیاری. | |
params. ttl | string | زمان برای زندگی در ثانیه برای کانال اطلاع رسانی. پیش فرض 604800 ثانیه است. | |
پاسخ
در صورت موفقیت آمیز بودن، این روش یک بدنه پاسخ با ساختار زیر را برمی گرداند:
{
"kind": "api#channel",
"id": string,
"resourceId": string,
"resourceUri": string,
"token": string,
"expiration": long
}
نام ملک | ارزش | توضیحات | یادداشت ها |
---|
kind | string | این را به عنوان یک کانال اعلان شناسایی می کند که برای تماشای تغییرات در یک منبع، که " api#channel " است، استفاده می شود. | |
id | string | یک UUID یا یک رشته منحصر به فرد مشابه که این کانال را شناسایی می کند. | |
resourceId | string | یک شناسه غیر شفاف که منبع در حال تماشا را در این کانال مشخص می کند. در نسخه های مختلف API پایدار است. | |
resourceUri | string | یک شناسه مخصوص نسخه برای منبع تماشا شده. | |
token | string | یک رشته دلخواه با هر اعلان از طریق این کانال به آدرس مورد نظر تحویل داده می شود. اختیاری. | |
expiration | long | تاریخ و زمان انقضای کانال اعلان، به صورت مهر زمانی یونیکس، در میلی ثانیه بیان می شود. اختیاری. | |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Events: watch\n\n| **Note:** [Authorization](#auth) optional.\n\nWatch for changes to Events resources.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `calendarId` | `string` | Calendar identifier. To retrieve calendar IDs call the [calendarList.list](/workspace/calendar/api/v3/reference/calendarList/list) method. If you want to access the primary calendar of the currently logged in user, use the \"`primary`\" keyword. |\n| **Optional query parameters** |||\n| `eventTypes` | `string` | Event types of resources to watch. Optional. This parameter can be repeated multiple times to watch resources of different types. If unset, returns all event types. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`birthday`\": Special all-day events with an annual recurrence. - \"`default`\": Regular events. - \"`focusTime`\": Focus time events. - \"`fromGmail`\": Events from Gmail. - \"`outOfOffice`\": Out of office events. - \"`workingLocation`\": Working location events. |\n\n### Authorization\n\nThis request allows authorization with at least one of the following scopes:\n\n| Scope |\n|-------------------------------------------------------------------|\n| `https://www.googleapis.com/auth/calendar.readonly` |\n| `https://www.googleapis.com/auth/calendar` |\n| `https://www.googleapis.com/auth/calendar.events.readonly` |\n| `https://www.googleapis.com/auth/calendar.events` |\n| `https://www.googleapis.com/auth/calendar.app.created` |\n| `https://www.googleapis.com/auth/calendar.events.freebusy` |\n| `https://www.googleapis.com/auth/calendar.events.owned` |\n| `https://www.googleapis.com/auth/calendar.events.owned.readonly` |\n| `https://www.googleapis.com/auth/calendar.events.public.readonly` |\n\nFor more information, see the [authentication and authorization](/workspace/guides/configure-oauth-consent) page.\n\n### Request body\n\nIn the request body, supply data with the following structure:\n\n```carbon\n{\n \"id\": string,\n \"token\": string,\n \"type\": string,\n \"address\": string,\n \"params\": {\n \"ttl\": string\n }\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|\n| `id` | `string` | A UUID or similar unique string that identifies this channel. | |\n| `token` | `string` | An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. | |\n| `type` | `string` | The type of delivery mechanism used for this channel. Valid values are \"`web_hook`\" (or \"`webhook`\"). Both values refer to a channel where Http requests are used to deliver messages. | |\n| `address` | `string` | The address where notifications are delivered for this channel. | |\n| `params` | `object` | Additional parameters controlling delivery channel behavior. Optional. | |\n| params.`ttl` | `string` | The time-to-live in seconds for the notification channel. Default is 604800 seconds. | |\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```text\n{\n \"kind\": \"api#channel\",\n \"id\": string,\n \"resourceId\": string,\n \"resourceUri\": string,\n \"token\": string,\n \"expiration\": long\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|----------|-------------------------------------------------------------------------------------------------------------------|-------|\n| `kind` | `string` | Identifies this as a notification channel used to watch for changes to a resource, which is \"`api#channel`\". | |\n| `id` | `string` | A UUID or similar unique string that identifies this channel. | |\n| `resourceId` | `string` | An opaque ID that identifies the resource being watched on this channel. Stable across different API versions. | |\n| `resourceUri` | `string` | A version-specific identifier for the watched resource. | |\n| `token` | `string` | An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. | |\n| `expiration` | `long` | Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional. | |"]]