3

I am trying to get all the applications installed on all the devices ios,ipad,iphone,android and windows devices using microsoft graph API.

my approach was first to get all the devices using https://graph.microsoft.com/v1.0/deviceManagement/manageddevices and then passing each device id to https://graph.microsoft.com/v1.0/deviceManagement/manageddevices('device_id')?$expand=detectedApps

but there are huge number of devices so the number of API calls i have to make is too many.

Is there any alternate way to do it .

Note:i tried https://graph.microsoft.com/v1.0/deviceManagement/manageddevices?$expand=detectedApps here but this seems to be not working.

Thanks

Search
  • 33
  • 5

1 Answers1

0

managedDevice resource type doesn't have any relationship to detectedApp but detectedApp resource type has a relationship to managedDevice.

Make a first call to get all devices

GET https://graph.microsoft.com/v1.0/deviceManagement/manageddevices

You can reduce the size of the response by selecting only some properties you need

GET https://graph.microsoft.com/v1.0/deviceManagement/manageddevices?$select=id

Then the second call to get detected apps and expand managedDevices

GET https://graph.microsoft.com/v1.0/deviceManagement/detectedApps?$expand=managedDevices
GET https://graph.microsoft.com/v1.0/deviceManagement/detectedApps?$expand=managedDevices($select=id)

Group detected apps from the second call by managed device id and compare them with a list of all devices from the first call to find out which devices have apps.

Resources:

List managed devices

List detected apps

detectedApp resource

user2250152
  • 14,658
  • 4
  • 33
  • 57
  • Thanks this is working is there a way I can get the device id's of devices that have the app installed as well from 2nd api call? – Search Feb 06 '23 at 15:37