Events: watch
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Tieni d'occhio le modifiche alle risorse Eventi.
Richiesta
Richiesta HTTP
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch
Parametri
Nome del parametro |
Valore |
Descrizione |
Parametri del percorso |
calendarId |
string |
Identificatore del calendario. Per recuperare gli ID calendario, chiama il metodo calendarList.list. Se vuoi accedere al calendario principale dell'utente che ha eseguito l'accesso, utilizza la parola chiave "primary ".
|
Parametri di query facoltativi |
eventTypes |
string |
Tipi di eventi delle risorse da monitorare. Facoltativo. Questo parametro può essere ripetuto più volte per guardare risorse di tipi diversi. Se non impostato, restituisce tutti i tipi di eventi.
I valori accettati sono:
- "
birthday ": eventi speciali che durano tutto il giorno con una ricorrenza annuale.
- "
default ": eventi regolari.
- "
focusTime ": eventi di momento di concentrazione.
- "
fromGmail ": eventi da Gmail.
- "
outOfOffice ": eventi fuori sede.
- "
workingLocation ": eventi relativi alla sede di lavoro.
|
Autorizzazione
Questa richiesta consente l'autorizzazione con almeno uno dei seguenti ambiti:
Ambito |
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 |
Per ulteriori informazioni, consulta la pagina Autenticazione e autorizzazione.
Corpo della richiesta
Nel corpo della richiesta, fornisci i dati con la seguente struttura:
{
"id": string,
"token": string,
"type": string,
"address": string,
"params": {
"ttl": string
}
}
Nome proprietà |
Valore |
Descrizione |
Note |
id |
string |
Un UUID o una stringa univoca simile che identifica questo canale. |
|
token |
string |
Una stringa arbitraria inviata all'indirizzo di destinazione con ogni notifica inviata tramite questo canale. Facoltativo. |
|
type |
string |
Il tipo di meccanismo di importazione utilizzato per questo canale. I valori validi sono "web_hook " (o "webhook "). Entrambi i valori fanno riferimento a un canale in cui vengono utilizzate le richieste HTTP per inviare i messaggi. |
|
address |
string |
L'indirizzo a cui vengono inviate le notifiche per questo canale. |
|
params |
object |
Parametri aggiuntivi che controllano il comportamento del canale di importazione. Facoltativo. |
|
params.ttl |
string |
Il tempo di vita in secondi per il canale di notifica. Il valore predefinito è 604800 secondi. |
|
Risposta
In caso di esito positivo, questo metodo restituisce un corpo della risposta con la seguente struttura:
{
"kind": "api#channel",
"id": string,
"resourceId": string,
"resourceUri": string,
"token": string,
"expiration": long
}
Nome proprietà |
Valore |
Descrizione |
Note |
kind |
string |
Identifica questo come un canale di notifica utilizzato per rilevare le modifiche a una risorsa, ovvero "api#channel ". |
|
id |
string |
Un UUID o una stringa univoca simile che identifica questo canale. |
|
resourceId |
string |
Un ID opaco che identifica la risorsa guardata su questo canale. Stabile nelle diverse versioni dell'API. |
|
resourceUri |
string |
Un identificatore specifico per la versione della risorsa guardata. |
|
token |
string |
Una stringa arbitraria inviata all'indirizzo di destinazione con ogni notifica inviata tramite questo canale. Facoltativo. |
|
expiration |
long |
Data e ora di scadenza del canale di notifica, espresse come timestamp Unix, in millisecondi. Facoltativo. |
|
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[],[],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. | |"]]