Search code examples
androidandroid-management-api

Updating profiles of android management API


I have managed to create an enterprise, policy and setup a device using the 'Android Management API - Quickstart' document.

1) But I am having trouble moving forward. I want to be able to change the policy and not sure how to go about it. Is there a setup need to be done to send the policy update request?

2) I tried to get the policy from the browser using https://androidmanagement.googleapis.com/v1/enterprises/*/policies/* which is from the References page of Android Management API https://androidmanagement.googleapis.com/v1/{name=enterprises/*/policies/*} and the response that is

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }
}

Any help will be appreciated


Solution

  • You can update the policy directly from the quickstart guide in the "Create a policy" section, the method for creating and updating a policy are the same.

    Alternatively you can create a service account and call the API with a client library.