14 Feb 2024 04:32 PM - last edited on 08 Aug 2024 02:40 PM by Michal_Gebacki
Hi Team,
We are using below API to get mobile applications host groups data but its not getting host entities related to mobile application.
/api/v2/entities?entitySelector=type(HOST),hostGroupName(%entity_name)&from=now-5y&fields=+tags,+managementZones,+properties,+fromRelationships,+toRelationships&pageSize=4000"
{
"entityId": "MOBILE_APPLICATION-556544",
"type": "MOBILE_APPLICATION",
"displayName": "Test",
"properties": {
"detectedName": "58baefdc-2771-4c84-9e78-453222",
"mobileOsFamily": ["ANDROID"],
"customizedName": "Test"
}
}
We have tried replacing above entity_name with entityId and detectedName attribute values like below but its not getting any entities.
/api/v2/entities?entitySelector=type(HOST),hostGroupName(58baefdc-2771-4c84-9e78-453222)&from=now-5y&fields=+tags,+managementZones,+properties,+fromRelationships,+toRelationships&pageSize=4000"
/api/v2/entities?entitySelector=type(HOST),hostGroupName(MOBILE_APPLICATION-556544)&from=now-5y&fields=+tags,+managementZones,+properties,+fromRelationships,+toRelationships&pageSize=4000"
Are we missing any thing here for getting hosts data for mobile applications ? How to get mobile applications hosts data here ?
Thanks,
Sunil
Solved! Go to Solution.
04 Apr 2024 02:53 PM - edited 04 Apr 2024 02:54 PM
You need a couple of concatenated selectors to derive the host group from a mobile app, to be specific this one:
type(host_group),toRelationships.isInstanceOf(type(host),toRelationships.runsOnHost(type(service),toRelationships.calls(type(mobile_application),entityName("<your mobile app name>"))))
The entity structure is based on relationships and you can navigate it from either entity type to another:
Here are the 3 separated selectors used in above one: