Reputation: 11
I'm trying to get the reports for all the Suspended accounts with a field "SuspensionTime" like the "creationTime". I'm unable to fetch the "SuspensionTime" of an account though the API.
I'm using the following Documentation referred by the Google. https://developers.google.com/admin-sdk/reports/v1/guides/manage-audit-admin
Upvotes: 1
Views: 487
Reputation: 1573
Apart from the Activities API: https://developers.google.com/admin-sdk/reports/reference/rest/v1/activities/list?apix_params=%7B%22userKey%22%3A%22all%22%2C%22applicationName%22%3A%22admin%22%2C%22eventName%22%3A%22SUSPEND_USER%22%7D
If the suspension comes from Google you can inspect the Users Usage Reports: https://developers.google.com/admin-sdk/reports/v1/appendix/usage/user/accounts
The field disabled_reason usually contains the date of the suspension.
Upvotes: 0
Reputation: 2426
You can use the activities.list method from the Reports API. The thing with this is that it requires the userKey parameter, which means that you depend on knowing which admin performed the action. It is easier if you have only a couple of admin accounts doing user suspensions.
You would need to send "SUSPEND_USER" in the event name field, and "admin" in the applicationName field to get all the user suspensions performed by that admin, and you will get the date and time in the "time" file of the response.
Upvotes: 2