Creates a new object (via upload, copy, or compose), applies object ACLs, or changes the storage class.
Use a PUT object request to:
Common request headers
The following are common request headers for PUT object requests.
Header | Description | Required |
---|---|---|
Authorization |
The authentication string for the request. | Yes |
Content-Length |
The length of the request body without headers (in bytes). * Not required for requests that use chunked transfer encoding. |
Yes* |
Content-Type |
The MIME type of the request body. If you do not specify a content type, Cloud Storage defaults to [`application/octet-stream`](https://tools.ietf.org/html/rfc2046#section-4.5.1) when it serves the object. | No (recommended) |
Content-MD5 |
The MD5 digest of the request message without headers. | No |
Date |
The date and time of the request. | Yes |
Host |
The URI for Cloud Storage. For more information, see Request Endpoints. | Yes |
Transfer-Encoding |
Indicates if the message body was chunked. | No (except for requests that use chunked transfer encoding) |
x-goog-if-generation-match |
If the generation you specify is the same as the object you're overwriting, then the object is overwritten. You can also specify 0 as a special value to indicate that the new object is only created if there is no existing object. | No |
x-goog-if-metageneration-match |
If the metageneration you specify is the same as the object you're trying to update, then the object metadata is updated. This is only allowed if x-goog-if-generation is specified. By combining these two generation properties, you can implement safe read-modify-write updates. |
No |
x-goog-storage-class |
Gives an object a storage class besides the default storage class of the associated bucket. | No |