Getting Asset Description and Type
I am writing code to get information for every asset in our Collibra system. I can get the community name, the domain name, the asset ID, and the asset name. What i can’t seem to get to is the asset type (column, table, etc.) and the asset description. Eventually, I need this data to populate an XL spreadsheet. But for now, just getting all the data would be an accomplishment.
listOfCommunities = communityApi.findCommunities(FindCommunitiesRequest.builder().build()).getResults()
for (community in listOfCommunities)
{
myCommunityID = community.getId()
myCommunityName = community.getName()
loggerApi.info("My Community ID: "+ myCommunityID)
loggerApi.info("My Community Name: "+ myCommunityName)
loggerApi.info('---------------------------------------------------')
ListOfDomains = domainApi.findDomains(FindDomainsRequest.builder().communityId(myCommunityID).build()).getResults()
for(Domain in ListOfDomains)
{
DomainId = Domain.getId()
DomainName= Domain.getName()
loggerApi.info('Domain Id: ' + DomainId)
loggerApi.info('Domain Name: ' + DomainName)
listOfAssets = assetApi.findAssets(FindAssetsRequest.builder().domainId(DomainId).build()).getResults()
for(asset in listOfAssets)
{
assetId = asset.getId()
assetName= asset.getName()
//assetType = asset.getType()
assetDesc= asset.getDesc()
loggerApi.info('Asset Id: ' + assetId)
loggerApi.info('Asset Name: ' + assetName)
//loggerApi.info('Asset Type: ' + assetType)
loggerApi.info('Asset Description: ' + assetDesc)
//-- Get Asset Type --
//-- get asset description --
}
}
}michaelwalter
Posted 5 years ago · Edited 1 year ago·Last reply 5 years ago
2 comments
Shirosh Tissera
·5 years ago · EditedHi Michael,
To get the type you would need to use assetobject.getType().getName()
To get the description you would need to use the attributeApi.findAttributes as the description is on the attribute object not on the asset.
Thank you
Shirosh
michaelwalter
OP5 years ago · EditedThanks! I will give it a try.