Demonstrates how to delete a file from an S3 bucket. This example deletes the file /chilkat.ocean/starfishCopy.jpg. A response status code equal to 204 is returned for success (with an empty response body).
curl -X DELETE https://chilkat.ocean.s3.us-west-2.amazonaws.com/starfishCopy.jpg
Dim rest As New ChilkatRest
Dim success As Long
Dim authAws As New ChilkatAuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
authAws.SecretKey = "AWS_SECRET_KEY"
authAws.Region = "us-west-2"
authAws.ServiceName = "s3"
success = rest.SetAuthAws(authAws)
' URL: https://chilkat.ocean.s3.us-west-2.amazonaws.com/starfishCopy.jpg
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("chilkat.ocean.s3.us-west-2.amazonaws.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
Debug.Print rest.LastErrorText
Exit Sub
End If
Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("DELETE","/starfishCopy.jpg",sbResponseBody)
If (success <> 1) Then
Debug.Print rest.LastErrorText
Exit Sub
End If
Dim respStatusCode As Long
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
Debug.Print "Response Status Code = " & respStatusCode
Debug.Print "Response Header:"
Debug.Print rest.ResponseHeader
Debug.Print "Response Body:"
Debug.Print sbResponseBody.GetAsString()
Exit Sub
End If