Method: projects.snapshots.patch

Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in subscriptions.seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

HTTP request


Path parameters

Parameters
snapshot.name

string

Optional. The name of the snapshot.

Request body

The request body contains data with the following structure:

JSON representation
{
 "snapshot": {
 "name": string,
 "topic": string,
 "expireTime": string,
 "labels": {
 string: string,
 ...
 }
 },
 "updateMask": string
}
Fields
snapshot.topic

string

Optional. The name of the topic from which this snapshot is retaining messages.

snapshot.expireTime

string (Timestamp format)

Optional. The snapshot is guaranteed to exist up until this time. A newly-created snapshot expires no later than 7 days from the time of its creation. Its exact lifetime is determined at creation by the existing backlog in the source subscription. Specifically, the lifetime of the snapshot is 7 days - (age of oldest unacked message in the subscription). For example, consider a subscription whose oldest unacked message is 3 days old. If a snapshot is created from this subscription, the snapshot -- which will always capture this 3-day-old backlog as long as the snapshot exists -- will expire in 4 days. The service will refuse to create a snapshot that would expire in less than 1 hour after creation.

Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014年10月02日T15:01:23Z", "2014年10月02日T15:01:23.045123456Z" or "2014年10月02日T15:01:23+05:30".

snapshot.labels

map (key: string, value: string)

Optional. See Creating and managing labels.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

updateMask

string (FieldMask format)

Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.

This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".

Response body

If successful, the response body contains an instance of Snapshot .

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/pubsub
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年08月22日 UTC.