0

I'm using the API REST Resource: userUsageReport [https://developers.google.com/admin-sdk/reports/reference/rest/v1/userUsageReport].

Everything was great until this week. This week I started to get a lot of warnings. The strange part is that if I query August 31st and August 29th I get a lot of warnings, but If I query August 30th, it's ok

"warnings": [
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application gmail is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "gmail"
                }
            ]
        },
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application accounts is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "accounts"
                }
            ]
        },
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application docs is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "docs"
                }
            ]
        },
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application gplus is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "gplus"
                }
            ]
        },
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application classroom is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "classroom"
                }
            ]
        },
        {
            "code": "PARTIAL_DATA_AVAILABLE",
            "message": "Data for date 2021-08-31 for application drive is not available right now, please try again after a few hours.",
            "data": [
                {
                    "key": "date",
                    "value": "2021-08-31"
                },
                {
                    "key": "application",
                    "value": "drive"
                }
            ]
        }
    ],

Any ideais why it's happening?

rafasalo
  • 243
  • 2
  • 16
  • I tried to use both API Explorer and Admin console to get user usage report on 2021-08-31 and encountered similar issue. In admin console it says `Data not available for the selected date. Please try for date before August 30, 2021 05:00 PM PDT (GMT-0700)'. You might want to file a bug in [issuetracker.google.com](https://issuetracker.google.com/) – Ron M Sep 03 '21 at 21:59

1 Answers1

0

I cant find a document explaining this behavior, but I have been using this API for reporting and I can only speak of my experience with it.

UserUsageReport is a huge report and is always 2+ days behind live data. Due to its size I believe google generate a new report every 24~48 hours and it likely generate it by segmenting it in to sections, so here is what I think is happening:

The response PARTIAL_DATA_AVAILABLE is like a "Warning" , and it indicates that for the given date there are probably some data missing in the given sections. If you look at the param used in the API call: https://developers.google.com/admin-sdk/reports/reference/rest/v1/customerUsageReports/get

GET https://admin.googleapis.com/admin/reports/v1/usage/dates/{date}

date: string

Represents the date the usage occurred. The timestamp is in the ISO 8601 format, yyyy-mm-dd. We recommend you use your account's time zone for this.

It only accept a whole day as an input, therefor its likely that the generation of the report sometimes goes beyond the given date and some of the "partial data" falls on the next day.

Another thing I noticed is that not always all the warring's are present, sometimes there are less or non. In my case sometimes I am getting the following ones :

accounts
gplus
sites
device_management

Which are huge chunk of the report in our environment.

Given that theory, I think is important to know what data are you looking for to extract from that report, depending on that you could easily discard the "warning". In one of my cases, I am using this report to get the total number of licenses assigned in our tenant, and that value is always the same. How can I get available license via Google Workspace Admin SDK?

Vasil Nikolov
  • 667
  • 6
  • 16