Google API to manage groups in admin environment

Hi all,

I am struggling setting up the Google API to manage Groups (add members) in the admin account.
What I have is: Service Account File (JSON) that should allow me to authenticate if I am not mistaken.

I am just stuck on how to set this up.
What I want is the following:

  1. Send API call to predefined scope with the “groups name” and “members name” to be added

I cannot find any documentation on how to set this up via HTTP requests and via Google Cloud scope or whatsoever does not seem to work. I am really stuck.

Hopefully somebody can help me.
Thank you so much in advance.

M.

Hi @martijn.pirozzi ,
Thanks for reaching out to the community.

You can try referring to the following steps.

  • Set up a project in the Google Cloud Console and enable the Groups API. This will require billing information to be added to the project.
  • Create a service account and download the service account credentials as a JSON file. This file will contain the authentication information needed to make API calls.
  • Add the service account to the Google Group as a member with the necessary permissions (i.e. the ability to add members).
  • Make an HTTP POST request to the Groups API endpoint to add members to the group.

Please mark it as a solution if you find this helpful. :writing_hand:
Happy Automation,

Regards,
@pratik.maskar

Hi @pratik.maskar ,

Thank you for responding.
Actually, this is what is already done (I think). The thing is, I do not have access to the Google Environment and got the JSON provided by the client. So, your first three points are already setup I think.

The last bullet point is still unclear to me. I know how to make HTTP requests, but the Google documentation does not tell me what headers and/or parameters I need to send, nor does the UiPath HTTP activity have any way to include the JSON file.

Could you elaborate on this specific point?

M.

Hi @martijn.pirozzi ,

I have a sample code here. You can refer that.
curl --request POST
https://www.googleapis.com/admin/directory/v1/groups/groupKey/members
–header ‘Authorization: Bearer [ACCESS_TOKEN]’
–header ‘Content-Type: application/json’
–data-raw ‘{
“email”: “user@example.com”,
“role”: “MEMBER”
}’

Regards,
@pratik.maskar

1 Like

@pratik.maskar

Thank you again.
This starts to help! I also found most of this in the Google Documentation. Now, to fill in the access token (Bearer) as a variable, I need to authenticate. I was under the impression this could be done with the JSON file, but how?

Any idea on how to get the access code/token?