0

我正在使用邮递员中的 rest api 从谷歌项目中检索计算引擎快照。我想使用过滤器检索在某个时间戳值之后创建的快照,如果我将“=”作为运算符传递,它的工作方式如下所示:

https://compute.googleapis.com/compute/v1/projects/my-project/global/snapshots?filter=(creationTimestamp="2020-05-25T06:06:45.366-07:00")

我想要过滤大于特定时间戳的记录,所以我使用它

 https://compute.googleapis.com/compute/v1/projects/my-project/global/snapshots?filter=(creationTimestamp>"2020-05-25T06:06:45.366-07:00") 

或者

(creationTimestamp>="2020-05-25T06:06:45.366-07:00") (Here I read in the documentation that we can only use !=, >, or <. so I am not sure whethere i can use >= or <=)

https://cloud.google.com/compute/docs/reference/rest/v1/snapshots/list

但即使对于 < 或 > 运营商我得到这个:

{
    "error": {
        "code": 400,
        "message": "Invalid value for field 'filter': 'creationTimestamp>2020-05-25T06:06:45.366-07:00'. Invalid list filter expression.",
        "errors": [
            {
                "message": "Invalid value for field 'filter': 'creationTimestamp>2020-05-25T06:06:45.366-07:00'. Invalid list filter expression.",
                "domain": "global",
                "reason": "invalid"
            }
        ]
    }
}

任何人都可以提出解决方案吗?谢谢

更新

我的最终目标是在 data-studio 中创建一个快照报告,那么有什么方法可以将其余的 api 快照数据获取到 bigquery 或任何其他可以创建此报告的数据源?

4

1 回答 1

0

根据评论将其发布为社区 Wiki。

不幸的是,当您比较字符串时,API 不会以您想要的方式回答。检索到完整列表后,您将需要手动过滤快照的创建日期。这样,您将无法在返回数据时过滤数据,而只能在您从实例中检索数据之后。

于 2020-10-12T06:12:48.367 回答