I'm trying to run the Quickstart in Python for the Group Migration API.
The goal is to insert a message to a Google group that I created for testing.
I've created a Google for Work account, and made a Google group that is owned by admin.
I created the credentials in console as "Client ID for Other" and set them up on my client.
When I run the script, I get:
googleapiclient.errors.HttpError:
<HttpError 400 when requesting
https://www.googleapis.com/upload/groups/v1/groups/test-migration-business%40googlegroups.com/archive?uploadType=media&alt=json
returned "com.google.gaia.client.InvalidUserIDException:
Request for GaiaClientConst::INVALID_USERID">
The authorization flow appeared to work fine. I get the confirmation in the browser tab. It creates the credentials file in my local directory.
I am authorizing as the admin user of the Google for Work account. I've enabled API access in the admin.google.com console. I've also been through the Prerequisites steps, and I think it's all set up OK.
Any idea what causes this?
Edit: I got some more information through another channel. The problem was with the group to which I was trying to post via the API.
It's not just about creating the group under a Google Groups for Business account. You have to go through a lot of setup in the admin.google.com panel. Eventually when you set it up right, you can create a group whose e-mail address is of the type: groupname@owndomain.com.
As long as it's creating your groups with the @googlegroups.com suffix in the e-mail address, the API call won't work.
I will write an alternative answer in a couple of days once I've explored doing this with SMTP e-mail adds instead.