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
integer li_rc
oleobject loo_Rest
integer li_Success
oleobject loo_AuthAws
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_XmlResponse
string ls_Tagging_xmlns
integer i
integer li_Count_i
string ls_TagPath
string ls_Key
string ls_Value
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_AuthAws = create oleobject
li_rc = loo_AuthAws.ConnectToNewObject("Chilkat_9_5_0.AuthAws")
loo_AuthAws.AccessKey = "AWS_ACCESS_KEY"
loo_AuthAws.SecretKey = "AWS_SECRET_KEY"
loo_AuthAws.Region = "us-east-1"
loo_AuthAws.ServiceName = "s3"
loo_Rest.SetAuthAws(loo_AuthAws)
// URL: https://chilkat100.s3.amazonaws.com/starfish.jpg?tagging
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("chilkat100.s3.amazonaws.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
return
end if
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestNoBodySb("GET","/starfish.jpg?tagging",loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_AuthAws
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
if li_RespStatusCode >= 400 then
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_AuthAws
destroy loo_SbResponseBody
return
end if
loo_XmlResponse = create oleobject
li_rc = loo_XmlResponse.ConnectToNewObject("Chilkat_9_5_0.Xml")
loo_XmlResponse.LoadSb(loo_SbResponseBody,1)
// See the Online Tool for Generating XML Parse Code
ls_Tagging_xmlns = loo_XmlResponse.GetAttrValue("xmlns")
i = 0
li_Count_i = loo_XmlResponse.NumChildrenHavingTag("TagSet|Tag")
do while i < li_Count_i
loo_XmlResponse.I = i
ls_Key = loo_XmlResponse.GetChildContent("TagSet|Tag[i]|Key")
ls_Value = loo_XmlResponse.GetChildContent("TagSet|Tag[i]|Value")
i = i + 1
loop
destroy loo_Rest
destroy loo_AuthAws
destroy loo_SbResponseBody
destroy loo_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>