API and graphql and following 2 blog posts

Hi all, beginner here. I am working on these 2 blog posts to get the graphql from the cloudflare console: https://developers.cloudflare.com/analytics/graphql-api/tutorials/capture-graphql-queries-from-dashboard/ and using curl as the client https://developers.cloudflare.com/analytics/graphql-api/getting-started/execute-graphql-query/ I am just trying to get the "Overview" section of a website. I used Chrome and followed the fist blog post to get the query. Here is the graphql: I removed the type annotations “: String”, replaced the zone and token, and also put in realistic dates. Here is the full command (sorry it is long, but it is the main view so seemed like a good place to start!) thx for any pointers/help!!! Had to upload the curl as a file...Hope I do this right 🙂
1 Reply
Chaika
Chaika4mo ago
What's the question here? Why your's is wrong? You're missing opening bracket/quotes/etc like shown in the payload structure in the first one you showed. Personally I like using GraphIQL, and that query can be made to work in it like:
{ viewer {
zones(filter: {zoneTag: "<zoneTag>"}) {
totals: httpRequests1hGroups(limit: 10000, filter: {datetime_geq: "2024-08-18T11:00:00Z", datetime_lt: "2024-08-20T11:00:00Z"}) {
uniq {
uniques
__typename
}
__typename
}
zones: httpRequests1hGroups(orderBy: [datetime_ASC], limit: 10000, filter: {datetime_geq: "2024-08-18T11:00:00Z", datetime_lt: "2024-08-20T11:00:00Z"}) {
dimensions {
timeslot: datetime
__typename
}
uniq {
uniques
__typename
}
sum {
browserMap {
pageViews
key: uaBrowserFamily
__typename
}
bytes
cachedBytes
cachedRequests
contentTypeMap {
bytes
requests
key: edgeResponseContentTypeName
__typename
}
clientSSLMap {
requests
key: clientSSLProtocol
__typename
}
countryMap {
bytes
requests
threats
key: clientCountryName
__typename
}
encryptedBytes
encryptedRequests
ipClassMap {
requests
key: ipType
__typename
}
pageViews
requests
responseStatusMap {
requests
key: edgeResponseStatus
__typename
}
threats
threatPathingMap {
requests
key: threatPathingName
__typename
}
__typename
}
__typename
}
__typename
}
__typename
}
}
{ viewer {
zones(filter: {zoneTag: "<zoneTag>"}) {
totals: httpRequests1hGroups(limit: 10000, filter: {datetime_geq: "2024-08-18T11:00:00Z", datetime_lt: "2024-08-20T11:00:00Z"}) {
uniq {
uniques
__typename
}
__typename
}
zones: httpRequests1hGroups(orderBy: [datetime_ASC], limit: 10000, filter: {datetime_geq: "2024-08-18T11:00:00Z", datetime_lt: "2024-08-20T11:00:00Z"}) {
dimensions {
timeslot: datetime
__typename
}
uniq {
uniques
__typename
}
sum {
browserMap {
pageViews
key: uaBrowserFamily
__typename
}
bytes
cachedBytes
cachedRequests
contentTypeMap {
bytes
requests
key: edgeResponseContentTypeName
__typename
}
clientSSLMap {
requests
key: clientSSLProtocol
__typename
}
countryMap {
bytes
requests
threats
key: clientCountryName
__typename
}
encryptedBytes
encryptedRequests
ipClassMap {
requests
key: ipType
__typename
}
pageViews
requests
responseStatusMap {
requests
key: edgeResponseStatus
__typename
}
threats
threatPathingMap {
requests
key: threatPathingName
__typename
}
__typename
}
__typename
}
__typename
}
__typename
}
}
depending on what your end game is, lots of programming languages have their own graphql libs and such to use
Want results from more Discord servers?
Add your server