Pobieranie i aktualizowanie ustawień Grup dyskusyjnych Google

Podczas aktualizowania i pobierania ustawień grup Google żądanie interfejsu API wymaga uwierzytelnienia i klucza API zgodnie z opisem w sekcji Tworzenie danych logowania. Więcej informacji znajdziesz w sekcji Więcej informacji o uwierzytelnianiu i autoryzowaniu.

Aktualizowanie wszystkich ustawień grupy

Aby zaktualizować ustawienia grupy, umieść nagłówek Authorization i klucz interfejsu API w tym żądaniu HTTP PUT:

PUT https://www.googleapis.com/groups/v1/groups/GROUP_ID

Zastąp GROUP_ID identyfikatorem grupy, aby np. zaktualizować ustawienia grupy sprzedaz@example.com:

PUT https://www.googleapis.com/groups/v1/groups/salesgroup@example.com

Treść żądania ma format JSON. Poniższy przykład pokazuje wszystkie możliwe ustawienia:

{
 "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": "false",
 "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"
}

Pomyślna odpowiedź zwraca kod stanu HTTP 200. Oprócz kodu stanu odpowiedź zawiera też zaktualizowane ustawienia grupy. Więcej informacji o tych ustawieniach znajdziesz w dokumentacji interfejsu API.

Poniższy przykład przedstawia odpowiedź w formacie 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": "false",
 "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"
}

Aktualizowanie niektórych ustawień grupy

Jeśli chcesz zaktualizować podzbiór tych ustawień, użyj żądania HTTP PATCH do częściowej aktualizacji.

  PATCH https://www.googleapis.com/groups/v1/groups/GROUP_ID
  

Pobieranie ustawień grupy

Aby pobrać ustawienia grupy, dodaj nagłówek Authorization do tego żądania HTTP GET:

GET https://www.googleapis.com/groups/v1/groups/groupUniqueId

Ten przykład pobiera ustawienia grupy sprzedaż@example.com:

GET https://www.googleapis.com/groups/v1/groups/salesgroup@example.com

Pomyślna odpowiedź zwraca kod stanu HTTP 200. Oprócz kodu stanu odpowiedź zawiera też ustawienia grupy salesgroup@example.com. Więcej informacji o tych ustawieniach znajdziesz w dokumentacji interfejsu API.

Poniższy przykład przedstawia odpowiedź w formacie 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": "false",
 "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"
}