xperseguers / t3ext-cloudflare

The Cloudflare TYPO3 extension ensures your TYPO3 website is running optimally on the Cloudflare platform.
https://extensions.typo3.org/extension/cloudflare
GNU General Public License v3.0
7 stars 11 forks source link

Rework Zone Analytics API to use GraphQL API #19

Open xperseguers opened 3 years ago

xperseguers commented 3 years ago

When using Bearer Authentication, the statistics module fails to show graphs. The API calls fails with an error:

Zone Analytics API is sunset and replaced by GraphQL API

xperseguers commented 3 years ago

https://developers.cloudflare.com/analytics/migration-guides/zone-analytics

xperseguers commented 3 years ago

Example query:

query {
  viewer {
    zones(filter:{zoneTag:"<REDACTED>"}) {
      httpRequests1dGroups(
        orderBy: [date_ASC]
        limit: 1000
        filter: { date_gt: "2021-05-01" }
      ) {
        date: dimensions {
          date
        }
        sum {
          cachedBytes
          bytes
        }
      }
    }
  }
}

Possible library to use (if not willing to write in raw cURL): https://github.com/mghoneimy/php-graphql-client