Deletes an empty bucket.
The DELETE Bucket method is a simple DELETE request with bucket scope. You must be a member of the project owners group to delete buckets. Also, all DELETE Bucket requests must be authenticated.
As a best practice, after you delete all of the objects from a bucket you should set the bucket ACLs so that no users can create objects in the bucket.
If there are objects in the bucket when you attempt to delete it you will get a
409 Conflict status code and the
body of the error response will contain BucketNotEmpty
in the
Code
element.
If the bucket does not exist you will get a
404 Not Found status code and the
body of the error response will contain NoSuchBucket
in the
Code
element.
Query string parameters
This request does not include query string parameters.
Request headers
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* |
Date |
The date and time of the request. | Yes |
Host |
The URI for Cloud Storage. For more information, see Request Endpoints. | Yes |
Request body elements
This request does not include an XML document in the request body.
Request syntax
DELETE / HTTP/1.1 Host: <bucket>.storage.googleapis.com Date: <date> Authorization: <authentication string> Content-Length: <request body length>
Response headers
The request can return a variety of response headers depending on the request headers you use.
Response body elements
The response does not include an XML document in the response body.
Example
The following example deletes a bucket named travel-maps.
Request
DELETE / HTTP/1.1 Host: travel-maps.storage.googleapis.com Date: Mon, 15 Feb 2010 11:00:00 GMT Content-Length: 0 Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg
Response
HTTP/1.1 204 No Content Date: Mon, 15 Feb 2010 11:00:01 GMT Expires: Mon, 15 Feb 2010 11:00:01 GMT