Search code examples
pythongoogle-apigoogle-groupsgoogle-groups-api

What is wrong with the Google groups api discovery URL?


I'm attempting to use a Python script to manage Google groups. The script is basically the following quickstart.py script provided by Google only modified to work on groups rather than docs. (See here.)

When attempting this:

service = build('groups', 'v1', credentials=creds)

The following error is returned:

googleapiclient.errors.HttpError: <HttpError 502 when requesting https://groups.googleapis.com/$discovery/rest?version=v1 returned "Bad Gateway">

A quick check of that URL in a browser results in a 502 error.

However, a check of other api discovery URLs seems to work fine. For example: Browsing to

https://notebooks.googleapis.com/$discovery/rest?version=v1

results in the requested discovery information being returned in JSON format as expected.

I've searched and read docs to the point of distraction but cannot seem to find what is wrong with the groups discovery URL. Any help would be appreciated.


Solution

  • I was looking in the wrong direction. More searching based on another error turned up the fact that I should be using the admin URL:

    https://admin.googleapis.com/$discovery/rest?version=directory_v1
    

    Thanks to this post for putting me on to that.