【问题标题】:Getting a Lot of Warnings when I use REST Resource: userUsageReport当我使用 REST 资源时收到很多警告:userUsageReport
【发布时间】:2021-09-03 19:53:27
【问题描述】:

我正在使用 API REST 资源:userUsageReport [https://developers.google.com/admin-sdk/reports/reference/rest/v1/userUsageReport]。

这周之前一切都很好。这周我开始收到很多警告。奇怪的是,如果我查询 8 月 31 日和 8 月 29 日,我会收到很多警告,但如果我查询 8 月 30 日,那就没问题了

"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"
                }
            ]
        }
    ],

知道为什么会这样吗?

【问题讨论】:

  • 我尝试同时使用 API Explorer 和管理控制台来获取 2021-08-31 的用户使用情况报告,并遇到了类似的问题。在管理控制台中,它显示“所选日期的数据不可用。请尝试在 2021 年 8 月 30 日下午 5:00 PDT (GMT-0700) 之前的日期。您可能想在issuetracker.google.com 中提交错误
  • 完成!非常感谢!

标签: google-admin-sdk


【解决方案1】:

我找不到解释此行为的文档,但我一直在使用此 API 进行报告,我只能谈谈我的经验。

UserUsageReport 是一个庞大的报告,总是比实时数据晚 2 天以上。由于它的大小,我相信谷歌每 24~48 小时会生成一份新报告,并且它可能会通过将其分成几部分来生成它,所以这就是我认为正在发生的事情:

响应PARTIAL_DATA_AVAILABLE 就像一个“警告”,它表明对于给定的date,在给定的部分中可能缺少一些数据。如果您查看 API 调用中使用的参数: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.

它只接受一整天作为输入,因此报告的生成有时可能会超过给定日期,并且某些“部分数据”会落在第二天。

我注意到的另一件事是,并非所有的交战都存在,有时甚至更少或没有。就我而言,有时我会得到以下结果:

accounts
gplus
sites
device_management

哪些是我们环境中报告的重要组成部分。

鉴于该理论,我认为了解您要从该报告中提取哪些数据很重要,这取决于您可以轻松丢弃“警告”。 在我的一个案例中,我使用此报告来获取在我们的租户中分配的许可证总数,并且该值始终相同。 How can I get available license via Google Workspace Admin SDK?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-29
    • 1970-01-01
    • 2012-10-06
    • 1970-01-01
    相关资源
    最近更新 更多