0

I am attempting to add a message to a G-suite group using the group migration API. The POST command looks like this:

https://www.googleapis.com/upload/groups/v1/groups/groupname@domain.com/archive?uploadType=media&access_token=ya29.Gm03...

Assume that "groupname@domain.com" is valid - I'm substituting the correct value here. The access token value is shortened above, but it should be valid. This was obtained using OAuth and the administrator id for my G-Suite domain. I can use this token successfully for the email API.

I have enabled the "group migration API" in my service account, and in my G-suite account, have enabled the scope "https://www.googleapis.com/auth/apps.groups.migration" for that service account. This scope is requested when I get the authentication token.

The problem? http error 401 (Unauthorized). Prior to getting to this point, I had received other http errors, such as 403 (forbidden) due to errors in scope, or 404 (not found) when I had the wrong group id. so I think I have gotten past that. What other steps do I need to take for proper authorization?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Jeff McKay
  • 161
  • 2
  • 16
  • Are you sure this is the API you should be using? https://developers.google.com/admin-sdk/groups-migration/v1/guides/manage-email-migrations – Linda Lawton - DaImTo Apr 26 '17 at 07:10
  • The documentation you pointed to is in fact the API that I am using - same POST url. The only difference I see is that instead of putting the auth token in the url, they put it in the http headers. I tried it the way documented but still get the same error. I do see some information to the effect that emails added will only go to the archive, not distributed to the group. I wanted to make sure that archiving was enabled for my group, but there appears to be no way to do that. – Jeff McKay Apr 26 '17 at 17:40
  • There appear to be different types of "groups" that Google defines - those with domain googlegroups.com and those created in G-Suite. I can't set archiving for G-Suite groups - what gives? – Jeff McKay Apr 26 '17 at 17:42
  • Based on the service-accounts tag you're using, I assume you're using a service account to get the OAuth token. If that's the case - did you use delegation to get an OAuth token as a superadmin of the domain? – Liron Jul 17 '19 at 14:32

1 Answers1

0

Ensure archiving is enabled for the group. In a browser, logged in as a super admin, go to

https://groups.google.com/a/DOMAIN_NAME.com/forum/?#!forum/GROUP_NAME

and then go Manage > Information > Content control > Archive options and ensure Archive messages to the group is ticked ON and click Save.

Peter
  • 5,501
  • 2
  • 26
  • 42