I have a sync script which is creating new groups and uploading settings, like so:
for group in self.groups:
try:
print("%s@%s" % (group, self.admin_directory.__domain__))
self.admin_directory.insert_group(email="%s@%s" % (group, self.admin_directory.__domain__),
name=group,
description=group)
time.sleep(1)
except HttpError as e:
if(e.resp.status == 409):
print("%s was already a group in Google." % group)
else:
print(e)
try:
print(json.dumps(self.groups[group]['settings'], indent=4))
self.groups_settings.update("%s@%s" % (group, self.admin_directory.__domain__),
self.groups[group]['settings'])
time.sleep(1)
except HttpError as e:
print(e)
My admin_directory
class and groups_settings
class use the google.oauth2
library
I have json which I load that looks like so:
{
"kind": "groupsSettings#groups",
"email": "<email>",
"name": "<group_name>",
"description": "<group_name>",
"whoCanJoin": "INVITED_CAN_JOIN",
"whoCanViewMembership": "ALL_MEMBERS_CAN_VIEW",
"whoCanViewGroup": "ALL_MEMBERS_CAN_VIEW",
"whoCanInvite": "NONE_CAN_INVITE",
"whoCanAdd": "ALL_MANAGERS_CAN_ADD",
"allowExternalMembers": "true",
"whoCanPostMessage": "ALL_IN_DOMAIN_CAN_POST",
"allowWebPosting": "false",
"primaryLanguage": "en",
"maxMessageBytes": 10485760,
"isArchived": "true",
"archiveOnly": "false",
"messageModerationLevel": "MODERATE_ALL_MESSAGES",
"spamModerationLevel": "REJECT",
"replyTo": "REPLY_TO_SENDER",
"customReplyTo": "",
"includeCustomFooter": "false",
"customFooterText": "",
"sendMessageDenyNotification": "false",
"defaultMessageDenyNotificationText": "",
"showInGroupDirectory": "false",
"allowGoogleCommunication": "false",
"membersCanPostAsTheGroup": "false",
"messageDisplayFont": "DEFAULT_FONT",
"includeInGlobalAddressList": "true",
"whoCanLeaveGroup": "ALL_MEMBERS_CAN_LEAVE",
"whoCanContactOwner": "ALL_IN_DOMAIN_CAN_CONTACT",
"whoCanAddReferences": "NONE",
"whoCanAssignTopics": "NONE",
"whoCanUnassignTopic": "NONE",
"whoCanTakeTopics": "NONE",
"whoCanMarkDuplicate": "NONE",
"whoCanMarkNoResponseNeeded": "NONE",
"whoCanMarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanMarkFavoriteReplyOnOwnTopic": "NONE",
"whoCanUnmarkFavoriteReplyOnAnyTopic": "NONE",
"whoCanEnterFreeFormTags": "NONE",
"whoCanModifyTagsAndCategories": "NONE",
"favoriteRepliesOnTop": "false"
}
When I use the exact JSON here in the API explorer, it works, but when I upload via this script, I get
<HttpError 400 when requesting https://www.googleapis.com/groups/v1/groups/<group_name>%40<domain>?alt=json returned "Invalid Value">
and I cannot seem to figure out why it is doing this.
Has anyone else experienced this issue and if so, were you able to figure out the error?