Hi,
This is half a complain and half a ask for help
tl:dr
I can’t manage to do anything with the API, anyone have resources or working example on how to get web analytics using it?
Long version:
I’m trying to use the Cloudflare API to get web analytics stuffs
Basically I want the number of people that visited my websites, what they visited, where they are from, etc
I found this: https://developers.cloudflare.com/analytics/graphql-api/getting-started/
but I can’t manage to do anything with it
The first link in https://developers.cloudflare.com/analytics/graphql-api/getting-started/authentication/graphql-client-headers/
leading to https://graphql.org/swapi-graphql?
give images totally different from the images shown
Most services using GraphQL have an intuitive online editor like this https://anilist.co/graphiql
with a nice documentation and examples but I didn’t find anything here
The examples in https://developers.cloudflare.com/analytics/graphql-api/getting-started/querying-basics/
gives me beautiful empty answers such as
{
"data": {
"viewer": {
"zones": [
{
"firewallEventsAdaptive": []
}
]
}
},
"errors": null
}
Which, being new with Cloudflare, I have no idea what they are about
I then tried the code in https://developers.cloudflare.com/analytics/graphql-api/tutorials/build-your-own-analytics/
which first give me a JS error “Uncaught TypeError: can’t convert undefined to object”
Then CORS issue (but well I was warned in the documentation)
So I tried to do the request on Postman and I got this
{
"data": {
"viewer": {
"zones": [
{
"httpRequests1dGroups": [
{
"date": {
"date": "2023-01-16"
},
"sum": {
"bytes": 715673668,
"cachedBytes": 33620347
}
},
{
"date": {
"date": "2023-01-17"
},
"sum": {
"bytes": 748948243,
"cachedBytes": 94501496
}
}
]
}
]
}
},
"errors": null
}
Same issue, I have no idea to do with that
The fact that you need to pay to access the support (which yeah, I understand the point, people have to earn money for their work) doesn’t help with that
So yeah, thanks if you reached that point, and if you have resources or anything on how to use all of that, I would greatly appreciate