Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Créer et gérer des invitations utilisateur
Cette page explique comment effectuer certaines opérations fondamentales avec l'API User Invitation de Cloud Identity.
Avant de commencer
Remarque : Avant d'utiliser l'une des API Cloud Identity, vous devez configurer Cloud Identity. Pour obtenir des instructions, consultez la section Configurer Cloud Identity.
Effectuez les tâches suivantes avant d'utiliser les informations fournies sur cette page :
Comme indiqué dans la présentation, pour pouvoir être invité, un compte utilisateur doit répondre à plusieurs critères. Vous pouvez utiliser la méthode IsInvitableUser() pour déterminer si un compte utilisateur donné est éligible.
GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:isInvitableUser
Récupérer des invitations d'utilisateurs
L'API User Invitation propose des méthodes de récupération d'une seule invitation utilisateur et de l'ensemble d'entre elles. Lorsque vous récupérez toutes les invitations des utilisateurs, vous pouvez éventuellement les filtrer par état et en définir l'ordre de tri.
Récupérer une invitation utilisateur
REST
Pour récupérer une seule invitation utilisateur, appelez customers.userinvitations.get() avec le numéro client et l'adresse e-mail du compte.
Exemple de demande
GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com
Récupérer une liste d'invitations d'utilisateurs
Tous les utilisateurs non gérés apparaissent automatiquement en tant qu'invitations à l'état NOT_YET_SENT jusqu'à ce que l'administrateur ou l'utilisateur final effectue une action. Une fois qu'un utilisateur accepte une invitation, le compte n'est plus considéré comme non géré.
Si vous appelez customers.userinvitations.list() avec l'état de la requête, cela ne renvoie que les utilisateurs dont l'invitation se trouve dans cet état.
Si vous appelez customers.userinvitations.list() sans l'état de la requête, cela renvoie les invitations de tous les utilisateurs.
Vous pouvez vérifier plusieurs états en ajoutant un opérateur or dans le filtre : state=='accepted'||state=='declined'
REST
Pour récupérer la liste des invitations d'utilisateurs, appelez customers.userinvitations.list() avec le numéro client et tous les paramètres de requête souhaités pour filtrer, trier et paginer les résultats. L'exemple suivant renvoie la liste de tous les utilisateurs non gérés, classés par ordre décroissant de l'heure de dernière mise à jour.
Exemple de demande
GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations?filter=state!='accepted'&orderBy='updateTime desc'
Envoyer des invitations d'utilisateurs
Les invitations d'utilisateurs ne sont pas automatiquement envoyées aux utilisateurs éligibles. Une fois que vous avez une liste des utilisateurs que vous souhaitez inviter, vous pouvez utiliser la méthode customers.userinvitations.send().
Une invitation sera également créée le cas échéant.
REST
Pour envoyer un e-mail d'invitation à un utilisateur, appelez la méthode customers.userinvitations.send() avec le numéro client et l'adresse e-mail du compte utilisateur.
Exemple de demande
POST https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:send
Annuler des invitations d'utilisateurs
Vous pouvez annuler des invitations d'utilisateurs jusqu'à ce qu'elles soient acceptées ou refusées.
Appelez la méthode customers.userinvitations.cancel() pour annuler une invitation.
REST
Pour annuler une invitation utilisateur, appelez customers.userinvitations.cancel() avec le numéro client et l'adresse e-mail du compte utilisateur.
Exemple de demande
POST https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:cancel
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/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis page provides guidance on using the Cloud Identity User Invitation API to manage user invitations, including checking eligibility, retrieving, sending, and canceling them.\u003c/p\u003e\n"],["\u003cp\u003eYou can verify if a user account is eligible for an invitation using the \u003ccode\u003eIsInvitableUser()\u003c/code\u003e method, which requires the customer ID and the user's email address.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows retrieval of single or multiple user invitations, with the option to filter by state and sort the results when retrieving a list of invitations.\u003c/p\u003e\n"],["\u003cp\u003eUser invitations are not automatically sent; you must use the \u003ccode\u003ecustomers.userinvitations.send()\u003c/code\u003e method to send an invitation email to a specific user, which also creates the invitation if one does not already exist.\u003c/p\u003e\n"],["\u003cp\u003eUser invitations can be canceled until they are accepted or declined, by using the \u003ccode\u003ecustomers.userinvitations.cancel()\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# Creating and managing user invitations\n======================================\n\nThis page explains how to perform some fundamental operations with the\nCloud Identity User Invitation API.\n\nBefore you begin\n----------------\n\n**Note:** Before you use any of the Cloud Identity APIs, you must set up\nCloud Identity. See [Setting up Cloud Identity](/identity/docs/set-up-cloud-identity-admin)\nfor instructions.\n\nPerform the following tasks before proceeding with the information on this page:\n\n- Read the [User Invitation API overview](/identity/docs/concepts/overview-user-invitations).\n- Set up the [User Invitation API](/identity/docs/how-to/setup-user-invitations).\n\nDetermining invitation eligibility\n----------------------------------\n\nAs noted in the [overview](/identity/docs/concepts/overview-user-invitations),\nto be invited a user account must meet multiple criteria. You can use the\n[`IsInvitableUser()`](/identity/docs/reference/rest/v1/customers.userinvitations/isInvitableUser)\nmethod to find out if a given user account is eligible. \n\n### REST\n\nTo check the eligibility of a user account, call\n[`customers.userinvitations.isInvitableUser()`](/identity/docs/reference/rest/v1/customers.userinvitations/isInvitableUser)\nwith the customer ID and the account's email address.\n\n**Sample request** \n\n GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:isInvitableUser\n\nRetrieving user invitations\n---------------------------\n\nThe User Invitation API provides methods for retrieving a single user\ninvitation and retrieving all of them. When retrieving all user invitations,\nyou can optionally filter them by state and set the sorting order.\n\n### Retrieving a single user invitation\n\n### REST\n\nTo retrieve a single user invitation, call\n[`customers.userinvitations.get()`](/identity/docs/reference/rest/v1/customers.userinvitations/get)\nwith the customer ID and the account's email address.\n\n**Sample request** \n\n GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com\n\n### Retrieving a list of user invitations\n\nAll unmanaged users appear automatically as invitations in the `NOT_YET_SENT`\nstate until otherwise acted upon by either the admin or the end user. Once an\ninvitation is accepted by the user, the account is no longer considered\nunmanaged.\n\n- If you call [`customers.userinvitations.list()`](/identity/docs/reference/rest/v1/customers.userinvitations/list) with the state in the request, it will return only users whose invitation is in that state.\n- If you call [`customers.userinvitations.list()`](/identity/docs/reference/rest/v1/customers.userinvitations/list) without the state in the request, it will return all user invitations.\n\nYou can check for multiple states by adding an `or` operator in the filter:\n`state=='accepted'||state=='declined'` \n\n### REST\n\nTo retrieve a list of user invitations, call\n[`customers.userinvitations.list()`](/identity/docs/reference/rest/v1/customers.userinvitations/list)\nwith the customer ID and any desired query parameters to filter, order, and\npaginate the results. The following example returns a list of all unmanaged\nusers, ordered by the last updated time in descending order.\n\n**Sample request** \n\n GET https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations?filter=state!='accepted'&orderBy='updateTime desc'\n\nSending user invitations\n------------------------\n\nUser invitations are not automatically sent to eligible users. Once you have a\nlist of the users you want to invite, you can use the\n[`customers.userinvitations.send()`](/identity/docs/reference/rest/v1/customers.userinvitations/send) method.\nThis will also create an invitation if it doesn't exist. \n\n### REST\n\nTo send a user invitation email to a user, call\n[`customers.userinvitations.send()`](/identity/docs/reference/rest/v1/customers.userinvitations/send)\nwith the customer ID and the user account's email address.\n\n**Sample request** \n\n POST https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:send\n\nCanceling user invitations\n--------------------------\n\nUser invitations can be canceled until they are either accepted or declined.\nCall the\n[customers.userinvitations.cancel()](/identity/docs/reference/rest/v1/customers.userinvitations/cancel)\nmethod to cancel an invitation. \n\n### REST\n\nTo cancel a user invitation, call\n[customers.userinvitations.cancel()](/identity/docs/reference/rest/v1/customers.userinvitations/cancel)\nwith the customer ID and the user account's email address.\n\n**Sample request** \n\n POST https://cloudidentity.googleapis.com/v1/customers/C00000000/userinvitations/writer@altostrat.com:cancel"]]