Resource: Watch
A watch for events for a form. When the designated event happens, a notification will be published to the specified target. The notification's attributes will include a formId
key that has the ID of the watched form and an eventType
key that has the string of the type.
Messages are sent with at-least-once delivery and are only dropped in extraordinary circumstances. Typically all notifications should be reliably delivered within a few seconds; however, in some situations notifications may be delayed.
A watch expires seven days after it is created unless it is renewed with watches.renew
JSON representation | |
---|---|
{ "id": string, "target": { object ( |
Fields | |
---|---|
id |
Output only. The ID of this watch. See notes on |
target |
Required. Where to send the notification. |
eventType |
Required. Which event type to watch for. |
createTime |
Output only. Timestamp of when this was created. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
expireTime |
Output only. Timestamp for when this will expire. Each A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
errorType |
Output only. The most recent error type for an attempted delivery. To begin watching the form again a call can be made to |
state |
Output only. The current state of the watch. Additional details about suspended watches can be found by checking the |
WatchTarget
The target for notification delivery.
JSON representation | |
---|---|
{
"topic": {
object ( |
Fields | |
---|---|
topic |
A Pub/Sub topic. To receive notifications, the topic must grant publish privileges to the Forms service account Pub/Sub delivery guarantees should be considered. |
CloudPubsubTopic
A Pub/Sub topic.
JSON representation | |
---|---|
{ "topicName": string } |
Fields | |
---|---|
topicName |
Required. A fully qualified Pub/Sub topic name to publish the events to. This topic must be owned by the calling project and already exist in Pub/Sub. |
EventType
Possible event types that can be watched.
Enums | |
---|---|
EVENT_TYPE_UNSPECIFIED |
Unspecified event type. This value should not be used. |
SCHEMA |
The schema event type. A watch with this event type will be notified about changes to form content and settings. |
RESPONSES |
The responses event type. A watch with this event type will be notified when form responses are submitted. |
ErrorType
Possible error types.
Enums | |
---|---|
ERROR_TYPE_UNSPECIFIED |
Unspecified error type. |
PROJECT_NOT_AUTHORIZED |
The cloud project does not have access to the form being watched. This occurs if the user has revoked the authorization for your project to access their form(s). Watches with this error will not be retried. To attempt to begin watching the form again a call can be made to watches.renew |
NO_USER_ACCESS |
The user that granted access no longer has access to the form being watched. Watches with this error will not be retried. To attempt to begin watching the form again a call can be made to watches.renew |
OTHER_ERRORS |
Another type of error has occurred. Whether notifications will continue depends on the watch state . |
State
Possible Watch states.
Enums | |
---|---|
STATE_UNSPECIFIED |
Unspecified state. |
ACTIVE |
Watch is active. |
SUSPENDED |
The watch is suspended due to an error that may be resolved. The watch will continue to exist until it expires. To attempt to reactivate the watch a call can be made to watches.renew |
Methods |
|
---|---|
|
Create a new watch. |
|
Delete a watch. |
|
Return a list of the watches owned by the invoking project. |
|
Renew an existing watch for seven days. |