0

I use the G Suite account create by ADMIN_DIRECTORY_USER api, and trying to use the follow link to get data of google hangouts meet I just create(by the account i create)

the following is my parameters and link

userKey : all

applicationName : meet

eventName : call_ended

https://developers.google.com/admin-sdk/reports/v1/appendix/activity/meet

the response i get is

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Access denied. You are not authorized to read activity records.",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Access denied. You are not authorized to read activity records."
 }
}

Can anyone help please! thanks

蘇柏綸
  • 39
  • 1
  • 10

1 Answers1

1

The API you are trying to use is available only to administrators which means that regular users of the domain are not able to use it and will therefore receive the 401 Access denied. You are not authorized to read activity records. error.

As explained in this document here, one of the prerequisites is to get a G Suite account and create an administrator.

Therefore, if the new user you have created is not an administrator, the error will persist.

If you want to update the user you have created and make it an admin, you just have to use the following request.

HTTP Request

POST https://www.googleapis.com/admin/directory/v1/users/userKey/makeAdmin

Body

{
  "status": true
}

Reference

ale13
  • 5,679
  • 3
  • 10
  • 25
  • i am trying to use that account to do the google calendar guickstart sample, but when i click the Enable the Google Calendar API button it just keep running. it that the same problem? – 蘇柏綸 Apr 11 '20 at 02:06
  • I try this api and it works, it the account become the administrator of the domain and also can login the g suite admin console, it not allowed in system, so, are there any lower level of authority can also get the report and use the google calendar api? – 蘇柏綸 Apr 13 '20 at 01:03
  • Hello @蘇柏綸, if you want to use the `Reports API` then you must have an administrator account. As for the calendar API, it doesn't matter. – ale13 Apr 13 '20 at 07:12