# Google Play EMM API . enterprises

## Instance Methods

Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications.

Completes the signup flow, by specifying the Completion token and Enterprise token. This request must not be called multiple times for a given Enterprise Token.

Deletes the binding between the EMM and enterprise. This is now deprecated; use this to unenroll customers that were previously enrolled with the 'insert' call, then enroll them again with the 'enroll' call.

Enrolls an enterprise with the calling EMM.

Generates a sign-up URL.

Retrieves the name and domain of an enterprise.

Returns a service account and credentials. The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side.

Returns the store layout for the enterprise. If the store layout has not been set, or if the store layout has no homepageId set, returns a NOT_FOUND error.

Establishes the binding between the EMM and an enterprise. This is now deprecated; use enroll instead.

Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call.

Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending.

Sends a test push notification to validate the EMM integration with the Google Cloud Pub/Sub service for this enterprise.

Set the account that will be used to authenticate to the API as the enterprise.

Sets the store layout for the enterprise.

Unenrolls an enterprise from the calling EMM.

### Method Details

`acknowledgeNotificationSet(notificationSetId=None)`

    Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications.

    Args:
      notificationSetId: string, The notification set ID as returned by Enterprises.PullNotificationSet. This must be provided.

`completeSignup(completionToken=None, enterpriseToken=None)`

    Completes the signup flow, by specifying the Completion token and Enterprise token. This request must not be called multiple times for a given Enterprise Token.

    Args:
      completionToken: string, The Completion token initially returned by GenerateSignupUrl.
      enterpriseToken: string, The Enterprise token appended to the Callback URL.

    Returns:
      An object of the form:

        { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
            # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
            # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
          "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
            { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
              "email": "A String", # The administrator's email address.
            },
          ],
          "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
          "id": "A String", # The unique ID for the enterprise.
          "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
          "name": "A String", # The name of the enterprise, for example, "Example, Inc".
        }

`delete(enterpriseId)`

    Deletes the binding between the EMM and enterprise. This is now deprecated; use this to unenroll customers that were previously enrolled with the 'insert' call, then enroll them again with the 'enroll' call.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)

`enroll(token, body)`

    Enrolls an enterprise with the calling EMM.

    Args:
      token: string, The token provided by the enterprise to register the EMM. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
          # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
          # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
        "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
          { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
            "email": "A String", # The administrator's email address.
          },
        ],
        "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
        "id": "A String", # The unique ID for the enterprise.
        "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
        "name": "A String", # The name of the enterprise, for example, "Example, Inc".
      }

    Returns:
      An object of the form:

        { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
            # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
            # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
          "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
            { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
              "email": "A String", # The administrator's email address.
            },
          ],
          "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
          "id": "A String", # The unique ID for the enterprise.
          "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
          "name": "A String", # The name of the enterprise, for example, "Example, Inc".
        }

`generateSignupUrl(callbackUrl=None)`

    Generates a sign-up URL.

    Args:
      callbackUrl: string, The callback URL to which the Admin will be redirected after successfully creating an enterprise. Before redirecting there the system will add a single query parameter to this URL named "enterpriseToken" which will contain an opaque token to be used for the CompleteSignup request.
    Beware that this means that the URL will be parsed, the parameter added and then a new URL formatted, i.e. there may be some minor formatting changes and, more importantly, the URL must be well-formed so that it can be parsed.

    Returns:
      An object of the form:

        { # A resource returned by the GenerateSignupUrl API, which contains the Signup URL and Completion Token.
        "url": "A String", # A URL under which the Admin can sign up for an enterprise. The page pointed to cannot be rendered in an iframe.
        "kind": "androidenterprise#signupInfo", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#signupInfo".
        "completionToken": "A String", # An opaque token that will be required, along with the Enterprise Token, for obtaining the enterprise resource from CompleteSignup.
      }

`get(enterpriseId)`

    Retrieves the name and domain of an enterprise.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)

    Returns:
      An object of the form:

        { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
            # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
            # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
          "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
            { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
              "email": "A String", # The administrator's email address.
            },
          ],
          "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
          "id": "A String", # The unique ID for the enterprise.
          "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
          "name": "A String", # The name of the enterprise, for example, "Example, Inc".
        }

`getServiceAccount(enterpriseId, keyType=None)`

    Returns a service account and credentials. The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side.

    This method can only be called after calling Enterprises.Enroll or Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times it will return an error.

    Subsequent calls after the first will generate a new, unique set of credentials, and invalidate the previously generated credentials.

    Once the service account is bound to the enterprise, it can be managed using the serviceAccountKeys resource.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)
      keyType: string, The type of credential to return with the service account. Required.
        Allowed values
          googleCredentials -
          pkcs12 -

    Returns:
      An object of the form:

        { # A service account identity, including the name and credentials that can be used to authenticate as the service account.
        "kind": "androidenterprise#serviceAccount", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#serviceAccount".
        "name": "A String", # The account name of the service account, in the form of an email address. Assigned by the server.
        "key": { # Credentials that can be used to authenticate as a service account. # Credentials that can be used to authenticate as this ServiceAccount.
          "type": "A String", # The file format of the generated key data.
          "kind": "androidenterprise#serviceAccountKey", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#serviceAccountKey".
          "data": "A String", # The body of the private key credentials file, in string format. This is only populated when the ServiceAccountKey is created, and is not stored by Google.
          "id": "A String", # An opaque, unique identifier for this ServiceAccountKey. Assigned by the server.
        },
      }

`getStoreLayout(enterpriseId)`

    Returns the store layout for the enterprise. If the store layout has not been set, or if the store layout has no homepageId set, returns a NOT_FOUND error.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)

    Returns:
      An object of the form:

        { # General setting for the Google Play for Work store layout, currently only specifying the page to display the first time the store is opened.
        "homepageId": "A String", # The ID of the store page to be used as the homepage. The homepage will be used as the first page shown in the Google Play for Work store.
            #
            # If a homepage has not been set, the Play store shown on devices will be empty. Not specifying a homepage on a store layout effectively empties the store.
            #
            # If there exists at least one page, this field must be set to the ID of a valid page.
        "kind": "androidenterprise#storeLayout", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayout".
      }

`insert(token, body)`

    Establishes the binding between the EMM and an enterprise. This is now deprecated; use enroll instead.

    Args:
      token: string, The token provided by the enterprise to register the EMM. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
          # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
          # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
        "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
          { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
            "email": "A String", # The administrator's email address.
          },
        ],
        "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
        "id": "A String", # The unique ID for the enterprise.
        "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
        "name": "A String", # The name of the enterprise, for example, "Example, Inc".
      }

    Returns:
      An object of the form:

        { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
            # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
            # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
          "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
            { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
              "email": "A String", # The administrator's email address.
            },
          ],
          "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
          "id": "A String", # The unique ID for the enterprise.
          "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
          "name": "A String", # The name of the enterprise, for example, "Example, Inc".
        }

`list(domain)`

    Looks up an enterprise by domain name. This is only supported for enterprises created via the Google-initiated creation flow. Lookup of the id is not needed for enterprises created via the EMM-initiated flow since the EMM learns the enterprise ID in the callback specified in the Enterprises.generateSignupUrl call.

    Args:
      domain: string, The exact primary domain name of the enterprise to look up. (required)

    Returns:
      An object of the form:

        { # The matching enterprise resources.
        "kind": "androidenterprise#enterprisesListResponse", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprisesListResponse".
        "enterprise": [ # An enterprise.
          { # An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows:
                # - For Google managed domain customers, the process involves using Enterprises.enroll and Enterprises.setAccount (in conjunction with artifacts obtained from the Admin console and the Google API Console) and submitted to the EMM through a more-or-less manual process.
                # - For Android for Work Accounts customers, the process involves using Enterprises.generateSignupUrl and Enterprises.completeSignup in conjunction with the Android for Work Sign-up UI (Google-provided mechanism) to create the binding without manual steps. As an EMM, you can support either or both approaches in your EMM console. See Create an Enterprise for details.
              "administrator": [ # Administrators of the enterprise. This is only supported for enterprises created via the EMM-initiated flow.
                { # This represents an enterprise administrator who can manage the enterprise in the Google Play for Work Store.
                  "email": "A String", # The administrator's email address.
                },
              ],
              "primaryDomain": "A String", # The enterprise's primary domain, such as "example.com".
              "id": "A String", # The unique ID for the enterprise.
              "kind": "androidenterprise#enterprise", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprise".
              "name": "A String", # The name of the enterprise, for example, "Example, Inc".
            },
        ],
      }

`pullNotificationSet(requestMode=None)`

    Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending.
    A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty.
    Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy.
    Multiple requests might be performed concurrently to retrieve notifications, in which case the pending notifications (if any) will be split among each caller, if any are pending.

    Args:
      requestMode: string, The request mode for pulling notifications. If omitted, defaults to WAIT_FOR_NOTIFCATIONS.
    If this is set to WAIT_FOR_NOTIFCATIONS, the request will eventually timeout, in which case it should be retried.
        Allowed values
          returnImmediately -
          waitForNotifications -

    Returns:
      An object of the form:

        { # A resource returned by the PullNotificationSet API, which contains a collection of notifications for enterprises associated with the service account authenticated for the request.
        "notification": [ # The notifications received, or empty if no notifications are present.
          { # A notification of one event relating to an enterprise.
            "appRestrictionsSchemaChangeEvent": { # An event generated when a new app version is uploaded to Google Play and its app restrictions schema changed. To fetch the app restrictions schema for an app, use Products.getAppRestrictionsSchema on the EMM API. # Notifications about new app restrictions schema changes.
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") for which the app restriction schema changed. This field will always be present.
            },
            "newPermissionsEvent": { # An event generated when new permissions are added to an app. # Notifications about new app permissions.
              "approvedPermissions": [ # The set of permissions that the enterprise admin has already approved for this application. Use Permissions.Get on the EMM API to retrieve details about these permissions.
                "A String",
              ],
              "requestedPermissions": [ # The set of permissions that the app is currently requesting. Use Permissions.Get on the EMM API to retrieve details about these permissions.
                "A String",
              ],
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") for which new permissions were added. This field will always be present.
            },
            "productAvailabilityChangeEvent": { # An event generated whenever a product's availability changes. # Notifications about product availability changes.
              "availabilityStatus": "A String", # The new state of the product. This field will always be present.
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") for which the product availability changed. This field will always be present.
            },
            "productApprovalEvent": { # An event generated when a product's approval status is changed. # Notifications about changes to a product's approval status.
              "approved": "A String", # Whether the product was approved or unapproved. This field will always be present.
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") for which the approval status has changed. This field will always be present.
            },
            "enterpriseId": "A String", # The ID of the enterprise for which the notification is sent. This will always be present.
            "installFailureEvent": { # An event generated when an app installation failed on a device # Notifications about an app installation failure.
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") for which the install failure event occured. This field will always be present.
              "userId": "A String", # The ID of the user. This field will always be present.
              "deviceId": "A String", # The Android ID of the device. This field will always be present.
              "failureDetails": "A String", # Additional details on the failure if applicable.
              "failureReason": "A String", # The reason for the installation failure. This field will always be present.
            },
            "appUpdateEvent": { # An event generated when a new version of an app is uploaded to Google Play. Notifications are sent for new public versions only: alpha, beta, or canary versions do not generate this event. To fetch up-to-date version history for an app, use Products.Get on the EMM API. # Notifications about app updates.
              "productId": "A String", # The id of the product (e.g. "app:com.google.android.gm") that was updated. This field will always be present.
            },
            "timestampMillis": "A String", # The time when the notification was published in milliseconds since 1970-01-01T00:00:00Z. This will always be present.
          },
        ],
        "kind": "androidenterprise#notificationSet", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#notificationSet".
        "notificationSetId": "A String", # The notification set ID, required to mark the notification as received with the Enterprises.AcknowledgeNotification API. This will be omitted if no notifications are present.
      }

`sendTestPushNotification(enterpriseId)`

    Sends a test push notification to validate the EMM integration with the Google Cloud Pub/Sub service for this enterprise.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)

    Returns:
      An object of the form:

        {
        "topicName": "A String", # The name of the Cloud Pub/Sub topic to which notifications for this enterprise's enrolled account will be sent.
        "messageId": "A String", # The message ID of the test push notification that was sent.
      }

`setAccount(enterpriseId, body)`

    Set the account that will be used to authenticate to the API as the enterprise.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A service account that can be used to authenticate as the enterprise to API calls that require such authentication.
        "kind": "androidenterprise#enterpriseAccount", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterpriseAccount".
        "accountEmail": "A String", # The email address of the service account.
      }

    Returns:
      An object of the form:

        { # A service account that can be used to authenticate as the enterprise to API calls that require such authentication.
          "kind": "androidenterprise#enterpriseAccount", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterpriseAccount".
          "accountEmail": "A String", # The email address of the service account.
        }

`setStoreLayout(enterpriseId, body)`

    Sets the store layout for the enterprise.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # General setting for the Google Play for Work store layout, currently only specifying the page to display the first time the store is opened.
      "homepageId": "A String", # The ID of the store page to be used as the homepage. The homepage will be used as the first page shown in the Google Play for Work store.
          #
          # If a homepage has not been set, the Play store shown on devices will be empty. Not specifying a homepage on a store layout effectively empties the store.
          #
          # If there exists at least one page, this field must be set to the ID of a valid page.
      "kind": "androidenterprise#storeLayout", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayout".
    }

    Returns:
      An object of the form:

        { # General setting for the Google Play for Work store layout, currently only specifying the page to display the first time the store is opened.
        "homepageId": "A String", # The ID of the store page to be used as the homepage. The homepage will be used as the first page shown in the Google Play for Work store.
            #
            # If a homepage has not been set, the Play store shown on devices will be empty. Not specifying a homepage on a store layout effectively empties the store.
            #
            # If there exists at least one page, this field must be set to the ID of a valid page.
        "kind": "androidenterprise#storeLayout", # Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayout".
      }

`unenroll(enterpriseId)`

    Unenrolls an enterprise from the calling EMM.

    Args:
      enterpriseId: string, The ID of the enterprise. (required)