0

I am getting below error when I try to run the code

API call to reports.userUsageReport.get failed with error: Invalid string value: 'dummy@mydomain.com'. Allowed values: [all, userkey] (line 13, file "Code")

  var page1 = AdminReports.UserUsageReport.get('dummy@mydomain.com', date, {
parameters: parameters.join(','),
 });

The surprising thing is that from 2 days it is failing with the error mentioned above but before that it was working fine from months and was daily run. There was no change in my code.

Even when I try to access the API out of box using below url, there is no field provided to enter the userkey as an input. https://developers.google.com/admin-sdk/reports/v1/reference/userUsageReport/get

ab.it.gcp
  • 151
  • 1
  • 14
  • For follow up it has been taken into account, better now is to follow the bug tracker : https://issuetracker.google.com/issues/142272009#comment2 – St3ph Oct 08 '19 at 15:42

3 Answers3

0

There seems to be a problem with the documentation/API. This issue was already reported here.

Meanwhile, use this alternative:

var CUSTOMERID = AdminDirectory.Users.get('dummy@mydomain.com').customerId;
var page1 = AdminReports.UserUsageReport.get('all', date, {
  customerId: CUSTOMERID,
  parameters: parameters.join(',')
});
ZektorH
  • 2,680
  • 1
  • 7
  • 20
0

Just an update: As of 10/9/19, this issues appears to have been resolved.

-1

The option above works for 'all' but in my case, I have an array of the profileID's I want to to check. As author of this thread mentioned above, this has all been working for quite some time. However, it is now giving the error he mentioned above for me as well.

for (var j = 0; j < userArray.length; j++) {

    do {
      page = AdminReports.UserUsageReport.get(userArray[j], date, {
        parameters: parameters.join(','),
        maxResults: 500,
        pageToken: pageToken
      });
      .......