Adds a set of tags to an existing S3 object. This example adds tags to the object named "starfish.jpg" located in the bucket "chilkat100".
curl -X PUT https://chilkat100.s3.amazonaws.com/starfish.jpg?tagging \
-d '<Tagging>
<TagSet>
<Tag>
<Key>animal</Key>
<Value>starfish</Value>
</Tag>
</TagSet>
</Tagging>'
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-east-1"
authAws.ServiceName = "s3"
success = rest.SetAuthAws(authAws)
' URL: https://chilkat100.s3.amazonaws.com/starfish.jpg?tagging
Dim bTls As Long
bTls = 1
Dim port As Long
port = 443
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("chilkat100.s3.amazonaws.com",port,bTls,bAutoReconnect)
If (success <> 1) Then
Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
Debug.Print rest.LastErrorText
Exit Sub
End If
' See the Online Tool for Generating XML Creation Code
Dim xml As New ChilkatXml
xml.Tag = "Tagging"
xml.UpdateChildContent "TagSet|Tag|Key","animal"
xml.UpdateChildContent "TagSet|Tag|Value","starfish"
Dim sbRequestBody As New ChilkatStringBuilder
success = xml.GetXmlSb(sbRequestBody)
Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestSb("PUT","/starfish.jpg?tagging",sbRequestBody,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