Pour mettre à jour et récupérer les paramètres des groupes Google, authentifiez chaque requête d'API et incluez une clé API. Pour en savoir plus, consultez Créer des identifiants d'accès. Pour en savoir plus, consultez À propos de l'authentification et de l'autorisation.
Modifier tous les paramètres d'un groupe
Pour mettre à jour les paramètres d'un groupe, incluez l'en-tête Authorization et la clé API dans la requête HTTP PUT suivante :
PUT https://www.googleapis.com/groups/v1/groups/GROUP_ID
Remplacez GROUP_ID par l'ID du groupe. Par exemple, la commande suivante met à jour les paramètres du groupe salesgroup@example.com :
PUT https://www.googleapis.com/groups/v1/groups/salesgroup@example.com
Le corps de la requête est au format JSON. L'exemple suivant montre tous les paramètres possibles :
{
"kind": "groupsSettings#groups",
"email": "salesgroup@example.com",
"name": "Sales Group",
"description": "This is the sales group",
"whoCanAdd": "ALL_MANAGERS_CAN_ADD",
"whoCanJoin": "INVITED_CAN_JOIN",
"whoCanViewMembership": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanViewGroup": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanInvite": "ALL_MANAGERS_CAN_INVITE",
"allowExternalMembers": "true",
"whoCanAddExternalMembers": "ONLY_ADMINS_CAN_ADD_EXTERNAL_MEMBERS",
"whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
"allowWebPosting": "true",
"primaryLanguage": "en",
"maxMessageBytes": 10240,
"isArchived": "true",
"archiveOnly": "false",
"messageModerationLevel": "MODERATE_NONE",
"spamModerationLevel": "ALLOW",
"replyTo": "REPLY_TO_IGNORE",
"customReplyTo": "sales@example.com",
"includeCustomFooter": "true",
"customFooterText": "This messages is from the Sales Group at example.com",
"sendMessageDenyNotification": "true",
"defaultMessageDenyNotificationText": "Your Message has been denied.",
"showInGroupDirectory": "false",
"allowGoogleCommunication": "false",
"membersCanPostAsTheGroup": "false",
"messageDisplayFont": "DEFAULT_FONT",
"includeInGlobalAddressList": "false",
"whoCanLeaveGroup": "ALL_MEMBERS_CAN_LEAVE",
"whoCanContactOwner": "ALL_IN_DOMAIN_CAN_CONTACT",
"whoCanAddReferences": "ALL_MEMBERS",
"whoCanAssignTopics": "NONE",
"whoCanUnassignTopic": "NONE",
"whoCanTakeTopics": "NONE",
"whoCanMarkDuplicate": "NONE",
"whoCanMarkNoResponseNeeded": "NONE",
"whoCanMarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanMarkFavoriteReplyOnOwnTopic": "NONE",
"whoCanUnmarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanEnterFreeFormTags": "NONE",
"whoCanModifyTagsAndCategories": "NONE",
"favoriteRepliesOnTop": "false",
"whoCanApproveMembers": "ALL_MANAGERS_CAN_APPROVE",
"whoCanBanUsers": "OWNERS_AND_MANAGERS",
"whoCanModifyMembers": "OWNERS_AND_MANAGERS",
"whoCanApproveMessages": "OWNERS_ONLY",
"whoCanDeleteAnyPost": "OWNERS_AND_MANAGERS",
"whoCanDeleteTopics": "OWNERS_AND_MANAGERS",
"whoCanLockTopics": "OWNERS_AND_MANAGERS",
"whoCanMoveTopicsIn": "NONE",
"whoCanMoveTopicsOut": "NONE",
"whoCanPostAnnouncements": "NONE",
"whoCanHideAbuse": "OWNERS_AND_MANAGERS",
"whoCanMakeTopicsSticky": "OWNERS_AND_MANAGERS",
"whoCanModerateMembers": "OWNERS_AND_MANAGERS",
"whoCanModerateContent": "OWNERS_ONLY",
"whoCanAssistContent": "ALL_MEMBERS",
"customRolesEnabledForSettingsToBeMerged": "false",
"enableCollaborativeInbox": "false",
"whoCanDiscoverGroup": "ALL_IN_DOMAIN_CAN_DISCOVER",
"defaultSender": "DEFAULT_SELF"
}
Une réponse réussie renvoie un code d'état HTTP 200. En plus du code d'état, la réponse renvoie les paramètres de groupe mis à jour. Pour en savoir plus sur ces paramètres, consultez la documentation de référence de l'API.
L'exemple suivant montre la réponse JSON :
{
"kind": "groupsSettings#groups",
"email": "salesgroup@example.com",
"name": "Sales Group",
"description": "This is the sales group",
"whoCanAdd": "ALL_MANAGERS_CAN_ADD",
"whoCanJoin": "INVITED_CAN_JOIN",
"whoCanViewMembership": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanViewGroup": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanInvite": "ALL_MANAGERS_CAN_INVITE",
"allowExternalMembers": "true",
"whoCanAddExternalMembers": "ONLY_ADMINS_CAN_ADD_EXTERNAL_MEMBERS",
"whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
"allowWebPosting": "true",
"primaryLanguage": "en",
"maxMessageBytes": 10240,
"isArchived": "true",
"archiveOnly": "false",
"messageModerationLevel": "MODERATE_NONE",
"spamModerationLevel": "ALLOW",
"replyTo": "REPLY_TO_IGNORE",
"customReplyTo": "sales@example.com",
"includeCustomFooter": "true",
"customFooterText": "This messages is from the Sales Group at example.com",
"sendMessageDenyNotification": "true",
"defaultMessageDenyNotificationText": "Your Message has been denied.",
"showInGroupDirectory": "false",
"allowGoogleCommunication": "false",
"membersCanPostAsTheGroup": "false",
"messageDisplayFont": "DEFAULT_FONT",
"includeInGlobalAddressList": "false",
"whoCanLeaveGroup": "ALL_MEMBERS_CAN_LEAVE",
"whoCanContactOwner": "ALL_IN_DOMAIN_CAN_CONTACT",
"whoCanAddReferences": "ALL_MEMBERS",
"whoCanAssignTopics": "NONE",
"whoCanUnassignTopic": "NONE",
"whoCanTakeTopics": "NONE",
"whoCanMarkDuplicate": "NONE",
"whoCanMarkNoResponseNeeded": "NONE",
"whoCanMarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanMarkFavoriteReplyOnOwnTopic": "NONE",
"whoCanUnmarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanEnterFreeFormTags": "NONE",
"whoCanModifyTagsAndCategories": "NONE",
"favoriteRepliesOnTop": "false",
"whoCanApproveMembers": "ALL_MANAGERS_CAN_APPROVE",
"whoCanBanUsers": "OWNERS_AND_MANAGERS",
"whoCanModifyMembers": "OWNERS_AND_MANAGERS",
"whoCanApproveMessages": "OWNERS_ONLY",
"whoCanDeleteAnyPost": "OWNERS_AND_MANAGERS",
"whoCanDeleteTopics": "OWNERS_AND_MANAGERS",
"whoCanLockTopics": "OWNERS_AND_MANAGERS",
"whoCanMoveTopicsIn": "NONE",
"whoCanMoveTopicsOut": "NONE",
"whoCanPostAnnouncements": "NONE",
"whoCanHideAbuse": "OWNERS_AND_MANAGERS",
"whoCanMakeTopicsSticky": "OWNERS_AND_MANAGERS",
"whoCanModerateMembers": "OWNERS_AND_MANAGERS",
"whoCanModerateContent": "OWNERS_ONLY",
"whoCanAssistContent": "ALL_MEMBERS",
"customRolesEnabledForSettingsToBeMerged": "false",
"enableCollaborativeInbox": "false",
"whoCanDiscoverGroup": "ALL_IN_DOMAIN_CAN_DISCOVER",
"defaultSender": "DEFAULT_SELF"
}
Modifier certains paramètres d'un groupe
Si vous souhaitez mettre à jour un sous-ensemble de ces paramètres, utilisez la requête HTTP PATCH pour une mise à jour partielle.
PATCH https://www.googleapis.com/groups/v1/groups/GROUP_ID
Récupérer les paramètres d'un groupe
Pour récupérer les paramètres d'un groupe, incluez l'en-tête Authorization dans la requête HTTP GET suivante :
GET https://www.googleapis.com/groups/v1/groups/groupUniqueId
L'exemple suivant récupère les paramètres du groupe salesgroup@example.com :
GET https://www.googleapis.com/groups/v1/groups/salesgroup@example.com
Une réponse réussie renvoie un code d'état HTTP 200. En plus du code d'état, la réponse renvoie les paramètres du groupe salesgroup@example.com. Pour en savoir plus sur ces paramètres, consultez la documentation de référence de l'API.
L'exemple suivant montre la réponse JSON :
{
"kind": "groupsSettings#groups",
"email": "salesgroup@example.com",
"name": "Sales Group",
"description": "This is the sales group",
"whoCanAdd": "ALL_MANAGERS_CAN_ADD",
"whoCanJoin": "INVITED_CAN_JOIN",
"whoCanViewMembership": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanViewGroup": "ALL_IN_DOMAIN_CAN_VIEW",
"whoCanInvite": "ALL_MANAGERS_CAN_INVITE",
"allowExternalMembers": "true",
"whoCanAddExternalMembers": "ONLY_ADMINS_CAN_ADD_EXTERNAL_MEMBERS",
"whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
"allowWebPosting": "true",
"primaryLanguage": "en",
"maxMessageBytes": 10240,
"isArchived": "true",
"archiveOnly": "false",
"messageModerationLevel": "MODERATE_NONE",
"spamModerationLevel": "ALLOW",
"replyTo": "REPLY_TO_IGNORE",
"customReplyTo": "sales@example.com",
"includeCustomFooter": "true",
"customFooterText": "This messages is from the Sales Group at example.com",
"sendMessageDenyNotification": "true",
"defaultMessageDenyNotificationText": "Your Message has been denied.",
"showInGroupDirectory": "false",
"allowGoogleCommunication": "false",
"membersCanPostAsTheGroup": "false",
"messageDisplayFont": "DEFAULT_FONT",
"includeInGlobalAddressList": "false",
"whoCanLeaveGroup": "ALL_MEMBERS_CAN_LEAVE",
"whoCanContactOwner": "ALL_IN_DOMAIN_CAN_CONTACT",
"whoCanAddReferences": "ALL_MEMBERS",
"whoCanAssignTopics": "NONE",
"whoCanUnassignTopic": "NONE",
"whoCanTakeTopics": "NONE",
"whoCanMarkDuplicate": "NONE",
"whoCanMarkNoResponseNeeded": "NONE",
"whoCanMarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanMarkFavoriteReplyOnOwnTopic": "NONE",
"whoCanUnmarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanEnterFreeFormTags": "NONE",
"whoCanModifyTagsAndCategories": "NONE",
"favoriteRepliesOnTop": "false",
"whoCanApproveMembers": "ALL_MANAGERS_CAN_APPROVE",
"whoCanBanUsers": "OWNERS_AND_MANAGERS",
"whoCanModifyMembers": "OWNERS_AND_MANAGERS",
"whoCanApproveMessages": "OWNERS_ONLY",
"whoCanDeleteAnyPost": "OWNERS_AND_MANAGERS",
"whoCanDeleteTopics": "OWNERS_AND_MANAGERS",
"whoCanLockTopics": "OWNERS_AND_MANAGERS",
"whoCanMoveTopicsIn": "NONE",
"whoCanMoveTopicsOut": "NONE",
"whoCanPostAnnouncements": "NONE",
"whoCanHideAbuse": "OWNERS_AND_MANAGERS",
"whoCanMakeTopicsSticky": "OWNERS_AND_MANAGERS",
"whoCanModerateMembers": "OWNERS_AND_MANAGERS",
"whoCanModerateContent": "OWNERS_ONLY",
"whoCanAssistContent": "ALL_MEMBERS",
"customRolesEnabledForSettingsToBeMerged": "false",
"enableCollaborativeInbox": "false",
"whoCanDiscoverGroup": "ALL_IN_DOMAIN_CAN_DISCOVER",
"defaultSender": "DEFAULT_SELF"
}