Mengambil & memperbarui setelan untuk Google Grup

Saat memperbarui dan mengambil setelan untuk Google Grup, permintaan API memerlukan autentikasi dan kunci API seperti yang dijelaskan dalam Membuat kredensial akses. Untuk informasi selengkapnya, lihat Mempelajari autentikasi & otorisasi.

Memperbarui semua setelan untuk grup

Untuk memperbarui setelan grup, sertakan header Authorization dan kunci API dalam permintaan HTTP PUT berikut:

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

Ganti GROUP_ID dengan ID untuk grup—misalnya, kode berikut akan memperbarui setelan grup salesgroup@example.com:

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

Isi permintaan dalam format JSON. Contoh berikut menunjukkan semua setelan yang mungkin:

{
 "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"
}

Respons yang berhasil akan menampilkan kode status HTTP 200. Bersama dengan kode status, respons akan menampilkan setelan grup yang diperbarui. Untuk informasi selengkapnya tentang setelan ini, lihat referensi API.

Contoh berikut menampilkan respons 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"
}

Memperbarui beberapa setelan untuk grup

Jika Anda ingin memperbarui sebagian setelan ini, gunakan permintaan HTTP PATCH untuk update parsial.

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

Mengambil setelan untuk grup

Untuk mengambil setelan grup, sertakan header Authorization dalam permintaan HTTP GET berikut:

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

Contoh berikut mengambil setelan grup salesgroup@example.com:

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

Respons yang berhasil akan menampilkan kode status HTTP 200. Bersama dengan kode status, respons akan menampilkan setelan grup salesgroup@example.com. Untuk informasi selengkapnya tentang setelan ini, lihat referensi API.

Contoh berikut menampilkan respons 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"
}