Deletes a fie (also known as an object) from a Google Cloud Storage bucket. The name of the bucket is specified in the URL's path. This example deletes the "starfish.jpg" object from the "chilkat-test" bucket. A successful DELETE is indicated by a 204 response status code with an empty response body.
curl -X DELETE https://www.googleapis.com/storage/v1/b/chilkat-bucket/o/starfish.jpg?project=MY_CLOUD_STORAGE_PROJECT \
--header "Authorization: Bearer CLOUD_STORAGE_TOKEN"
use chilkat();
$rest = chilkat::CkRest->new();
# URL: https://www.googleapis.com/storage/v1/b/chilkat-bucket/o/starfish.jpg?project=MY_CLOUD_STORAGE_PROJECT
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect("www.googleapis.com",$port,$bTls,$bAutoReconnect);
if ($success != 1) {
print "ConnectFailReason: " . $rest->get_ConnectFailReason() . "\r\n";
print $rest->lastErrorText() . "\r\n";
exit;
}
$rest->AddHeader("Authorization","Bearer CLOUD_STORAGE_TOKEN");
$sbResponseBody = chilkat::CkStringBuilder->new();
$success = $rest->FullRequestNoBodySb("DELETE","/storage/v1/b/chilkat-bucket/o/starfish.jpg?project=MY_CLOUD_STORAGE_PROJECT",$sbResponseBody);
if ($success != 1) {
print $rest->lastErrorText() . "\r\n";
exit;
}
$respStatusCode = $rest->get_ResponseStatusCode();
if ($respStatusCode >= 400) {
print "Response Status Code = " . $respStatusCode . "\r\n";
print "Response Header:" . "\r\n";
print $rest->responseHeader() . "\r\n";
print "Response Body:" . "\r\n";
print $sbResponseBody->getAsString() . "\r\n";
exit;
}