Returns the tags associated with an object. This example gets the tags for the object named "starfish.jpg" located in the bucket "chilkat100".
curl -X GET https://chilkat100.s3.amazonaws.com/starfish.jpg?tagging
load ./chilkat.dll
set rest [new_CkRest]
set authAws [new_CkAuthAws]
CkAuthAws_put_AccessKey $authAws "AWS_ACCESS_KEY"
CkAuthAws_put_SecretKey $authAws "AWS_SECRET_KEY"
CkAuthAws_put_Region $authAws "us-east-1"
CkAuthAws_put_ServiceName $authAws "s3"
CkRest_SetAuthAws $rest $authAws
# URL: https://chilkat100.s3.amazonaws.com/starfish.jpg?tagging
set bTls 1
set port 443
set bAutoReconnect 1
set success [CkRest_Connect $rest "chilkat100.s3.amazonaws.com" $port $bTls $bAutoReconnect]
if {[expr $success != 1]} then {
puts "ConnectFailReason: [CkRest_ConnectFailReason $rest]"
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkAuthAws $authAws
exit
}
set sbResponseBody [new_CkStringBuilder]
set success [CkRest_FullRequestNoBodySb $rest "GET" "/starfish.jpg?tagging" $sbResponseBody]
if {[expr $success != 1]} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkAuthAws $authAws
delete_CkStringBuilder $sbResponseBody
exit
}
set respStatusCode [CkRest_ResponseStatusCode $rest]
if {[expr $respStatusCode >= 400]} then {
puts "Response Status Code = $respStatusCode"
puts "Response Header:"
puts [CkRest_responseHeader $rest]
puts "Response Body:"
puts [CkStringBuilder_getAsString $sbResponseBody]
delete_CkRest $rest
delete_CkAuthAws $authAws
delete_CkStringBuilder $sbResponseBody
exit
}
set xmlResponse [new_CkXml]
CkXml_LoadSb $xmlResponse $sbResponseBody 1
# See the Online Tool for Generating XML Parse Code
set Tagging_xmlns [CkXml_getAttrValue $xmlResponse "xmlns"]
set i 0
set count_i [CkXml_NumChildrenHavingTag $xmlResponse "TagSet|Tag"]
while {[expr $i < $count_i]} {
CkXml_put_I $xmlResponse $i
set Key [CkXml_getChildContent $xmlResponse "TagSet|Tag[i]|Key"]
set Value [CkXml_getChildContent $xmlResponse "TagSet|Tag[i]|Value"]
set i [expr $i + 1]
}
delete_CkRest $rest
delete_CkAuthAws $authAws
delete_CkStringBuilder $sbResponseBody
delete_CkXml $xmlResponse
<?xml version="1.0" encoding="UTF-8" ?>
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>habitat</Key>
<Value>ocean</Value>
</Tag>
<Tag>
<Key>phylum</Key>
<Value>Echinodermata</Value>
</Tag>
<Tag>
<Key>animal</Key>
<Value>starfish</Value>
</Tag>
</TagSet>
</Tagging>