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"
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)
set rest = CreateObject("Chilkat_9_5_0.Rest")
' 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) Then
outFile.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
success = rest.AddHeader("Authorization","Bearer CLOUD_STORAGE_TOKEN")
set sbResponseBody = CreateObject("Chilkat_9_5_0.StringBuilder")
success = rest.FullRequestNoBodySb("DELETE","/storage/v1/b/chilkat-bucket/o/starfish.jpg?project=MY_CLOUD_STORAGE_PROJECT",sbResponseBody)
If (success <> 1) Then
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
outFile.WriteLine("Response Status Code = " & respStatusCode)
outFile.WriteLine("Response Header:")
outFile.WriteLine(rest.ResponseHeader)
outFile.WriteLine("Response Body:")
outFile.WriteLine(sbResponseBody.GetAsString())
WScript.Quit
End If
outFile.Close