API Discussions
Discussions and questions regarding the Cato Networks API
Best Practices
Find Cato Network API best practices, tips, and tricks
Recent Content
How to get the result of mutation
Hello team, We are currently considering using the Cato API to automate configuration for our customers. We would like to create sites, administrators, policies, etc. with the mutation commands, and then retrieve and display the applied settings with the query command. Based on the schema and actual behavior, we have confirmed that this is possible with firewall policies and administrators. However, I am not able to get more information than ID and name in the site settings. Is there any way to get these detailed configuration information? If not, is there any plan to implement this in the near future? thankyou,Solved34Views0likes2CommentsCato API with Gradio
Hello, During the "AMA about Cato API" webinar, you presented a demo of API usages with Gradio. Will you eventually share the code examples that you used to make these dashboards ? I would like to reproduce something similar (hit rules, detected applications by rules..) Regards, Pierre23Views1like1CommentAPI get statut Topology
Hello Cato team, I am looking for a solution to monitor certain statuses on your API. The objective is to obtain the status and counter "Connected," "Degraded," or "Disconnected" present in the topology. I am looking for the URL request that can provide this. For better understanding of the reason for this request, I use a ticketing tool that can make API requests. I use this to check the API statuses, and based on the results, open ITSM tickets. Thank for you time16Views0likes1CommentYou Ask a Good Question: Top 5 Applications Per Site, by Total Bandwidth
The Ask: I’d like to be able to see the top 5 applications, per site, by total bandwidth. Basically, this graph multiple times. API Guy answer: My solution is a multi-query approach. Step 1: This appStats query to get the list of site names and their total traffic: Step 2: Iterate over each site, calling an appStats() query for each one, with the site name as the filter. Here’s an example for one site: You will need to then calculate the percentages based on the total for each site from the first query.30Views0likes0CommentsA simple example in Python
import json import ssl import urllib.parse import urllib.request headers = { "x-api-key": MY_API_KEY, "Content-Type": "application/json" } body = { "operationName": "accountSnapshot", "variables": {"accountID":MY_ACCOUNT_ID}, "query": ''' query accountSnapshot($accountID:ID!) { accountSnapshot(accountID:$accountID) { id } }''' } request = urllib.request.Request(url='https://api.catonetworks.com/api/v1/graphql2', data=json.dumps(body).encode("ascii"), headers=headers) response = urllib.request.urlopen(request, context=ssl._create_unverified_context()) print(json.loads(response.read().decode("utf-8","replace")))42Views2likes2Comments