Initiates a resumable upload with a
POST request. This initial request
generates a session URI for use in subsequent
PUT requests which
upload the data. The initial request also allows you to specify metadata
for the object. Once a resumable upload completes, the uploaded object replaces
any existing object with the same name. For tips on uploading to
Cloud Storage, see best practices.
For simple uploads with the XML API, you make a
PUT Object request
instead of using
Query string parameters
This request does not typically include query string parameters.
The following request headers can be used.
||The authentication string for the request.||Yes|
||The conditions under which a publicly accessible object should be
||A header that specifies presentational information about how the object data is to be transmitted.||No|
||The compression algorithm that was used to compress the object you are uploading.||No|
||The ISO 639-1 language code of the content.||No|
The length of the request body without headers (in bytes). For initiating a resumable upload, this value is 0.
||The MIME type of the object to be uploaded. If you do not specify a content type, Cloud Storage defaults to
||The date and time of the request.||Yes|
||The URI for Cloud Storage. For more information, see Request Endpoints.||Yes|
||The predefined ACL that you want to apply to the object.||No|
||A user-specified date and time.||No|
||The customer-managed encryption key to use to encrypt the object.||No|
||If the generation you specify is the same as the object you're replacing, then the object is replaced. 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|
||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
||An extension header that can be used to store custom metadata.||No|
||Indicates that this request initiates the resumable upload. This header must use the value
||Gives an object a storage class besides the default storage class of the associated bucket.||No|
||The project to be billed for charges associated with the request. Note that the project specified in the initial request is used in all future requests associated with the resumable upload.||No|
To provide a customer-supplied encryption key along with the object upload, use the headers listed on the Customer-Supplied Encryption Key page in your request.
Request body elements
This request does not include an XML document in the request body.
The response includes a Location header that indicates the session URI to use when uploading the object data.
Response body elements
The response does not include an XML document in the response body.
The following sample uploads an object named paris.jpg to a bucket named travel-maps.
POST /paris.jpg HTTP/2 Host: travel-maps.storage.googleapis.com Date: Thu, 10 Dec 2020 18:11:50 GMT Content-Type: image/jpg Content-Length: 0 X-Goog-Resumable: start Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg
HTTP/2 201 Content-Type: text/plain; charset=utf-8 X-Guploader-Uploadid: ABf5-UxjuGIOxcy0OpOLoAHbmo5rYKWx3XfrZFTjowNwPT9JYiopVZW2gPFrusVKO5kaSZ7fNrDWkb9sT_lKxOssUTE Location: https://storage.googleapis.com/nstocktest/xmltestinit.jpg?upload_id=ABf5-UxjuGIOxcy0OpOLoAHbmo5rYKWx3XfrZFTjowNwPT9JYiopVZW2gPFrusVKO5kaSZ7fNrDWkb9sT_lKxOssUTE Content-Length: 0 Date: Thu, 10 Dec 2020 18:11:53 GMT Server: UploadServer