Android Management API: List of Enterprises/Policies?
Asked Answered
S

1

2

This is driving me nuts. I've successfully followed the Android Management API Quickstart to create a project/enterprise/policy and install it on a device.

I stupidly didn't write down the enterprise or policy IDs. I tried to create a new set, but the non-enterprise email now gives an error that it's already part of another EMM.

Is there a place in the console where I can see a list of the enterprises and/or policies that I've created? Where are these stored?

Edit: I found the enterprises.get method in the API but if I put enterprises/* in the name field (per the validation) I get a 400 error indicating Invalid enterprise id. Provide a valid id. so I'm unsure how to move forward.

Suh answered 24/10, 2019 at 1:36 Comment(0)
T
4

You can find the enterprise you created by logging into play.google.com/work with the account that was used to create it.

Click on Admin Settings to see the Organization name and Organization ID

Admin Settings

And to find the policies of all the devices you have enrolled to this enterprise, you can simply call the API - enterprises.devices.list entering the parent in the form enterprises/{enterpriseId} [ enterpriseId here is the OrganizationID that you get from the above steps ]

This would list all the devices attached to the enterprise and in the response you can find policyName of each device.

Terreverte answered 24/10, 2019 at 6:59 Comment(5)
Hello - it appears that organizations are not the same thing as enterprises... when I try any of these API calls with the organization ID I'm getting a permission error (403). Any ideas?Suh
You can use the method enterprises.policies.list to list all the policies ever created for this enterprise.Hourly
Thanks @Hourly - what I mean is that the Organization ID that displays on the page does not appear to be a valid Enterprise ID. When I try to use the any of the API links (listed in my original question) it tries to authenticate via oAuth popup and then says my user doesn't have the right permissions, even though I'm using the account that created it.Suh
@Suh are you sure the account that you are using is the account with which you created it ? Because the OrganizationId is for sure the enterprise, also make sure in the OAuth popup you select the same account to authenticate. And like @Hourly suggested you can use enterprises.policies.list to list all the policies ever created but the reason I've suggested enterprises.devices.list is because you will get the devices which are alive and attached to the enterprise and it's easy to identify which device has which policy.Terreverte
Thanks @Sudhu. It's worth mentioning that even when selecting the correct enterprise ID (Organization ID), a 403 error occurs for G Suite users. There seems to be no way to link an existing G Suite organization/enterprise with the Android Management API. You need to create an arbitrary Gmail account. Has anyone found a way around this?Solander

© 2022 - 2025 — McMap. All rights reserved.