How to get hostGroupName entities for mobile applications?

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

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:

  • type(service),toRelationships.calls(type(mobile_application),entityName(“foo”))
  • type(host),toRelationships.runsOnHost(type(service),entityName(“foo”))
  • type(host_group),toRelationships.isInstanceOf(type(host),entityName(“foo”))