Getting total bandwidth and unique visitors from Graphql API

Hello everyone,

I am a bit confused about the Cloudflare Graphql API, and I just need to be sure that this is the right query to get total bandwidth and unique visitors for a particular site:

query = '''
{
  viewer {
    zones(filter: { zoneTag: $zoneTag }) {
      httpRequests1dGroups( limit: 100, filter: { date_geq: $date_geq }) {
        sum {
          bytes
        }
        uniq {
          uniques
        }
      }
    }
  }
}
'''

Is this the right query? if now what is?

My question came from the fact that can see some differences on both between what I get from the API and what I have on webgui.

Thank you in advance.

So I had to install GraphQL Network addon on chrome, and through it was able to pick both requests and response being done.

The issue is that a “totals” should be added:

zones( filter: { zoneTag: $zoneTag }) { totals: httpRequests1dGroups( limit: 10000, filter: { date_geq: $date_geq, date_lt: $date_lt }) {

But must say that really don’t know why I am unable to use:

filter: { datetime_geq: $since, datetime_lt: $until }
even using the right format “%Y-%m-%dT%H:%M:%SZ”.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.