Want deviceId for enrolled devices through AMA API. Enrolling group of devices through same token id. How do we get deviceId's?
Want deviceId for enrolled devices through AMA API. Enrolling group of devices through same token id. How do we get deviceId's?
You can use the enterprises.devices.list to get the list of devices for a given enterprise. It returns a JSON of device resources that contains the deviceID.
The deviceID can be found in the name field of the device resource.
E.g.
name: enterprises/{enterpriseId}/devices/{deviceId}
Sample JSON response:
{
"name": "enterprises/LCqwe1231/devices/123qwe1231",
"managementMode": "DEVICE_OWNER",
"state": "ACTIVE",
"appliedState": "ACTIVE",
"policyCompliant": true,
}
Note: The previous DeviceIDs enrolled are still in the enterprise. If you get a list of DeviceIDs, get the ID that is in the uppermost part of the list. If you want to delete previous devices, you can use enterprises.devices.delete.