2

Is it possible to automatically retrieve Google Classroom audit logs via an API or similar method, instead of downloading them manually from the Admin Console?

I initially thought I could use the Admin SDK Reports API, but it turns out that Classroom is not supported.

Regarding the BigQuery Export feature, I am currently using the Google Workspace for Education Fundamentals license, which does not support the export functionality.

according to the following Reports API documentation, it does seem that applicationName = classroom is not supported: https://developers.google.com/workspace/admin/reports/reference/rest/v1/activities/list#applicationname

However, when I look at the following page, it seems to suggest that Classroom is supported: https://developers.google.com/workspace/admin/reports/v1/appendix/activity/classroom

For example, when I run the following code using the Python client library:

from google.oauth2 import service_account
from googleapiclient.discovery import build
SCOPES = [
 "https://www.googleapis.com/auth/admin.reports.audit.readonly",
 "https://www.googleapis.com/auth/admin.reports.usage.readonly"
]
SERVICE_ACCOUNT_FILE = r"<SERVICE_ACCOUNT_FILE>"
ADMIN_USER = "<ADMIN_USER>"
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
delegated_credentials = credentials.with_subject(ADMIN_USER)
service = build("admin", "reports_v1", credentials=delegated_credentials)
results = (
 service.activities()
 .list(userKey="all", applicationName="classroom", maxResults=10)
 .execute()
)
activities = results.get("items", [])
print(activities)

I get the following error:

TypeError Traceback (most recent call last)
Cell In[5], line 18
 13 delegated_credentials = credentials.with_subject(ADMIN_USER)
 14 service = build("admin", "reports_v1", credentials=delegated_credentials)
 16 results = (
 17 service.activities()
---> 18 .list(userKey="all", applicationName="classroom", maxResults=10)
 19 .execute()
 20 )
 21 activities = results.get("items", [])
 22 print(activities)
TypeError: Parameter "applicationName" value "classroom" does not match the pattern "access_transparency)|(admin)|(calendar)|(chat)|(chrome)|(context_aware_access)|(data_studio)|(drive)|(gcp)|(gplus)|(groups)|(groups_enterprise)|(jamboard)|(keep)|(login)|(meet)|(mobile)|(rules)|(saml)|(token)|(user_accounts)|(vault)"

On the other hand, if I use applicationName="login", I can successfully retrieve logs.

0

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.