KSC Open API  13.1
Kaspersky Security Center API description
array ListTags::GetTags ( array  pIdArray,
params  pParams = NULL 
)

Get tag values for specified list items.

Retrieves tag values for specified list items

Parameters:
pIdArray(array) collection of list item identifiers . Value semantics depends on the list type (for HostsTags it is the host id and so on)
pParamsreserved. (params)
Returns:
(array) of paramParams objects where each of them has the following structure:
  • "KLTAGS_ITEM_ID" - list item identifier. Type depends on the list type ( for InventoryTags and UmdmDeviceTags it is integer, for HostsTags from 10SP2 it is string )
  • "KLTAGS_TAGS" - (array) of (wstring) tags that are associated with list item

See also Python code with use of KlAkOAPI Python package below:

        server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False)
        oTagsControl = KlAkOAPI.ListTags.KlAkListTags(server, 'HostsTags')
        oHostIds = FindHosts(server)   # see sample_tagcontrol.py for implementation details
        oTagArray = oTagsControl.GetTags(oHostIds, {}).RetVal()
        for oTagEntry in oTagArray:
            oTagValues = oTagEntry["KLTAGS_TAGS"]            
            strTags = ""
            for oTagValue in oTagValues:
                if strTags != "":
                    strTags += ", "
                strTags += oTagValue
            print("Tagged item id: ", oTagEntry["KLTAGS_ITEM_ID"], ", Tags set for this id: ", strTags)