Dino
Dino
CDCloudflare Developers
Created by Dino on 11/26/2024 in #general-help
API call to get number of requests on a website
Hello, I have a domain name in Cloudlflare, I need to monitor the number of requests that It receiving for every 10 min ago, if the site isn't receiving any request within this time, I have to be notified. This seems to be possible by using GraphQl, despite when I do my python code to get this information, i have no result, but If I go in the dashboard > Go to Analytics & Logs, i can see that the website had received the requests for the 10min ago, I need to know if there is anyway to get this information with GraphQl of any other API please, here is the query request that I use in my python code I edit the two variables since_str and until_str with the time needed, you can find in the attachement the full code where I use this query, thanks for your help 🙂 query = """ query GetZoneAnalytics($zoneTag: String!, $since: String!, $until: String!) { viewer { zones(filter: {zoneTag: $zoneTag}) { httpRequests1mGroups(orderBy: [datetimeMinute_ASC], limit: 3000, filter: {datetime_geq: $since, datetime_lt: $until}) { dimensions { datetimeMinute } sum { browserMap { pageViews uaBrowserFamily } bytes cachedBytes cachedRequests contentTypeMap { bytes requests edgeResponseContentTypeName } clientSSLMap { requests clientSSLProtocol } countryMap { bytes requests threats clientCountryName } encryptedBytes encryptedRequests ipClassMap { requests ipType } pageViews requests responseStatusMap { requests edgeResponseStatus } threats threatPathingMap { requests threatPathingName }
1 replies