通过 CloudFlare API 在 GraphQL 中按查询字符串和请求路径进行过滤

问题描述 投票:0回答:1

现在可以在 Cloudflare 请求的 GraphQL 中通过 pathquery string 过滤数据吗?

我想通过 Cloudflare API 实现

我想出的如下所示:

{
    viewer {
        zones(filter: { zoneTag: "MY_ZONE_ID" }) {
            httpRequestsAdaptiveGroups(
                limit: 10000
                filter: {
                    datetime_geq: "2023-10-16T00:00:00Z"
                    datetime_lt: "2023-10-17T00:00:00Z"
                    clientRequestHTTPHost: "my.domain.com"
                }
            ) {
                sum {
                    visits
                }
            }
        }
    }
}

我使用了https://pages.johnspurlock.com/graphql-schema-docs/cloudflare.txt中给出的模式,其中说

clientRequestPath: "/my.file"
clientRequestQuery_like: "?my=query"

可以使用,但是使用上述过滤器时结果为0。当我删除过滤器时,结果大于 0。

这些文件肯定可以访问,因为我可以从 CF 仪表板看到它。

所以我想知道,在 GraphQL API 中是否真的可以使用查询字符串和路径进行过滤?

附注Cloudflare Network Analysis API 已弃用,因此无法使用。

graphql postman cloudflare cloudflare-api
1个回答
0
投票

clientRequestQuery_like
是使用
%
作为通配符的挑剔搜索,

clientRequestQuery
表示不带
?
分隔符的整个查询字符串(例如
section=539061&expand=comments

所以你可以像下面的查询一样使用

  • clientRequestQuery_like: "%my=query%"
    (包括)

  • clientRequestQuery: "my=query"
    (完全匹配)

参考

© www.soinside.com 2019 - 2024. All rights reserved.