Important : Nous n'acceptons plus de nouvelles inscriptions à l'API EMM Play.
En savoir plus
Enterprises: getServiceAccount
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Renvoie un compte de service et des identifiants. Le compte de service peut être associé à l'entreprise en appelant setAccount. Le compte de service est propre à cette entreprise et à l'EMM, et sera supprimé si l'entreprise n'est plus associée. Les identifiants contiennent des données de clé privée et ne sont pas stockés côté serveur.
Cette méthode ne peut être appelée qu'après l'appel de Enterprises.Enroll ou Enterprises.CompleteSignup, et avant Enterprises.SetAccount. Dans le cas contraire, elle renvoie une erreur.
Les appels suivants après le premier génèrent un nouvel ensemble d'identifiants uniques et invalident les identifiants précédemment générés.
Une fois le compte de service associé à l'entreprise, il peut être géré à l'aide de la ressource serviceAccountKeys.
.
Requête
Requête HTTP
GET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/serviceAccount
Paramètres
Nom du paramètre |
Valeur |
Description |
Paramètres de chemin d'accès |
enterpriseId |
string |
ID de l'entreprise.
|
Paramètres de requête facultatifs |
keyType |
string |
Type d'identifiant à renvoyer avec le compte de service. Obligatoire.
Les valeurs acceptées sont les suivantes :
- "
googleCredentials "
- "
pkcs12 "
|
Autorisation
Cette requête nécessite une autorisation ayant la portée suivante:
Champ d'application |
https://www.googleapis.com/auth/androidenterprise |
Pour en savoir plus, consultez la page Authentification et autorisation.
Corps de la requête
Ne spécifiez pas de corps de requête pour cette méthode.
Réponse
Si la requête aboutit, cette méthode renvoie un corps de réponse présentant la structure suivante :
{
"kind": "androidenterprise#serviceAccount",
"name": string,
"key": serviceaccountkeys Resource
}
Nom de propriété |
Valeur |
Description |
Remarques |
name |
string |
Nom du compte de service, au format d'adresse e-mail. Attribué par le serveur. |
|
key |
nested object |
Identifiants pouvant être utilisés pour s'authentifier en tant que compte de service. |
|
kind |
string |
|
|
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/03/26 (UTC).
[null,null,["Dernière mise à jour le 2025/03/26 (UTC)."],[[["\u003cp\u003eGenerates a service account and credentials that are unique to the enterprise and EMM and can be used for authentication.\u003c/p\u003e\n"],["\u003cp\u003eThe service account can be bound to the enterprise using the \u003ccode\u003esetAccount\u003c/code\u003e call and managed with the \u003ccode\u003eserviceAccountKeys\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eRequires prior enrollment or signup completion and executing this method invalidates previously generated credentials, issuing new ones.\u003c/p\u003e\n"],["\u003cp\u003eOnly specific key types (\u003ccode\u003egoogleCredentials\u003c/code\u003e or \u003ccode\u003epkcs12\u003c/code\u003e) are supported when requesting the service account.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/androidenterprise\u003c/code\u003e scope is necessary for this request.\u003c/p\u003e\n"]]],[],null,["# Enterprises: getServiceAccount\n\n| **Note:** Requires [authorization](#auth).\n\nReturns a service account and credentials. The service account\ncan be bound to the enterprise by calling setAccount. The service account\nis unique to this enterprise and EMM, and will be deleted if the enterprise\nis unbound. The credentials contain private key data and are not stored\nserver-side.\n\n\u003cbr /\u003e\n\n\nThis method can only be called after calling\nEnterprises.Enroll or Enterprises.CompleteSignup, and before\nEnterprises.SetAccount; at other times it will return an error.\n\n\u003cbr /\u003e\n\n\nSubsequent calls after the first will generate a new, unique set of\ncredentials, and invalidate the previously generated credentials.\n\n\u003cbr /\u003e\n\n\nOnce the service account is bound to the enterprise, it can be managed\nusing the serviceAccountKeys resource.\n\n\u003cbr /\u003e\n\n\n\u003cbr /\u003e\n\n| **Note:** After you create a key, you might need to wait for 60 seconds or more before you perform another operation with the key. If you try to perform an operation with the key immediately after you create the key, and you receive an error, you can [retry\n| the request with exponential backoff](https://cloud.google.com/iam/docs/retry-strategy)\n\n\u003cbr /\u003e\n\n.\n\n\u003cbr /\u003e\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/serviceAccount\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `enterpriseId` | `string` | The ID of the enterprise. |\n| **Optional query parameters** |||\n| `keyType` | `string` | The type of credential to return with the service account. Required. \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`googleCredentials`\" - \"`pkcs12`\" |\n\n### Authorization\n\nThis request requires authorization with the following scope:\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/androidenterprise` |\n\nFor more information, see the [authentication and authorization](/android/work/play/emm-api/v1/how-tos/authorizing) page.\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```text\n{\n \"kind\": \"androidenterprise#serviceAccount\",\n \"name\": string,\n \"key\": serviceaccountkeys Resource\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|-----------------|---------------------------------------------------------------------------------------------------|-------|\n| `name` | `string` | The account name of the service account, in the form of an email address. Assigned by the server. | |\n| `key` | `nested object` | Credentials that can be used to authenticate as this ServiceAccount. | |\n| `kind` | `string` | | |"]]