Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Objects: patch

Updates a data blob's associated metadata. This method supports patch semantics. Try it now or see an example .

The authenticated user must have OWNER permissions on the object.

Request

HTTP request

PATCH https://www.googleapis.com/storage/v1/b/bucket/o/object

Parameters

Parameter name Value Description
Path parameters
bucket string Name of the bucket in which the object resides.
object string Name of the object.
Optional query parameters
generation long If present, selects a specific revision of this object (as opposed to the latest version, the default).
ifGenerationMatch long Makes the operation conditional on whether the object's current generation matches the given value.
ifGenerationNotMatch long Makes the operation conditional on whether the object's current generation does not match the given value.
ifMetagenerationMatch long Makes the operation conditional on whether the object's current metageneration matches the given value.
ifMetagenerationNotMatch long Makes the operation conditional on whether the object's current metageneration does not match the given value.
predefinedAcl string Apply a predefined set of access controls to this object.

Acceptable values are:
  • " authenticatedRead ": Object owner gets OWNER access, and allAuthenticatedUsers get READER access.
  • " bucketOwnerFullControl ": Object owner gets OWNER access, and project team owners get OWNER access.
  • " bucketOwnerRead ": Object owner gets OWNER access, and project team owners get READER access.
  • " private ": Object owner gets OWNER access.
  • " projectPrivate ": Object owner gets OWNER access, and project team members get access according to their roles.
  • " publicRead ": Object owner gets OWNER access, and allUsers get READER access.
projection string Set of properties to return. Defaults to no_acl .

NOTE: Currently only works if you override the default and specify full .

Acceptable values are:
  • " full ": Include all properties.
  • " noAcl ": Omit the acl property.


Request body

In the request body, supply the relevant portions of an object resource , according to the rules of patch semantics.

Response

By default, this responds with an object resource in the response body. If you provide the URL parameter alt=media , then it will respond with the object data in the response body.

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Python

Uses the Python client library .

# The object_resource need only specify the attributes we want to change.
object_resource = {
        'contentType': 'text/plain',
        'contentLanguage': None,      # None clears the field.
        'metadata': {'my-key': 'my-new-value'},
}
req = client.objects().patch(
        bucket=bucket_name,
        object=object_name,
        projection='full',
        body=object_resource)
resp = req.execute()
print json.dumps(resp, indent=2)

Try it!

Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer .

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.