Reputation: 165
Here we use a lot of google groups to organize, when i create a new group i have to set manually all the preferences.. very boring!!
So i'd like to write a google apps script (if possible) to do the work. I found the "Groups settings API" and to understand i'm playing in the playground;. I set uniqueId of a group (the mail address) and checked out some fields like description, i was expecting to see the field's content somewhere, But it always give back something like this:
Request
GET https://www.googleapis.com/groups/v1/groups/xxx%40aaaaa.it?fields=description&key={YOUR_API_KEY}
Response
400 OK
cache-control: private, max-age=0
content-encoding: gzip
content-length: 213
content-type: application/vnd.google.gdata.error+xml; charset=UTF-8
date: Thu, 06 Aug 2015 10:29:37 GMT
expires: Thu, 06 Aug 2015 10:29:37 GMT
server: GSE
vary: Origin, X-Origin
[application/vnd.google.gdata.error+xml; charset=UTF-8 data]
Using a patch action i can change the group description but in the playground i have a response like the previous
I'm very new to this environment and missing some basic info, the questions are: - where are the information caming back from the api? - can Google Apps Script use the APIs?
Thanks, Marco
Upvotes: 0
Views: 248
Reputation: 2017
There is actually an API provided through advanced services within Google apps script to do use group settings. Find info on this api here.
To enable it in apps script, from the script editor, open the resources menu and select Advanced Google Services.
Scroll down the the group settings api and turn it on. You will also need to enable this api in the developers console. To do this, open your developers console, select APIS and Auth, Apis, then search for and enable the group settings api.
You can now use the api within the script using the AdminGroupsSettings object.
For example, to get a group use the following code:
var groupId = 'yourGroupId@gmail.com';
var group = AdminGroupSettings.get(groupId);
You can modify the group as you with and apply the changes with the .update or .patch method.
Upvotes: 2