How we got into GraphQL
One of our partners in the LATAM region is working with an end customer, to implement a custom predictive maintenance dashboard, by pulling in and correlating data from multiple sources (like Zabbix, Jira Cloud, Cato Networks, Extreme Networks CloudIQ, etc.) and sending out the data to update a Grafana dashboard, which can read data from OpenSearch.
Partner is using our data bots and low-code/no-code pipelines to implement this project. Prior to CloudFabrix, the partner had a couple of resources to implement this project using a Python-based scripting approach, but quickly got into a skills shortage and was not able to keep up with customer demands.
Now, with CloudFabrix, the partner is able to implement and customize this project faster than ever. As part of this engagement, we got a request from the partner to provide a GraphQL bot for Cato Networks.
Asking around and Exploring GraphQL
This got us really curious – we had a lot of REST API-based bots, but not GraphQL bot, and we haven’t heard of Cato Networks before. We quickly huddled up with our partner and found out more about the requirement. Within a couple of days, we had a fully working version of the GraphQL bot implemented.
Let me first briefly talk about GraphQL. For pros, this may be a repeat, but it was somewhat new to me. I stumbled upon this blog, which clearly explained the benefits of GraphQL-based approach vs REST API-based approach.
What’s so special about GraphQL
The key takeaway for me was how GraphQL was efficient in returning a lot of custom data in one query. Essentially GraphQL doesn’t over-fetch or under-fetch like REST APIs, and that is a sort of game-changer. When talking to my colleagues, from the Engineering department, I enquired about GraphQL and what their thoughts are?. They said that the concept is somewhat similar to what SNMP has done with MIBs. That insight gave me a better understanding of GraphQL. Our team is on board and we quickly developed the bots.
Cato Networks Example with GraphQL Bot
This bot can post a GraphQL query to API endpoint
--> @graphql:query url="https://api.catonetworks.com/api/v1/graphql2" and secret_name="cato_token" and template_col = "cato_graph_query"
url– the endpoint
secret_name– encrypted credential where
template_col– formatting template, where the plain text GraphQL is stored.
For more details about the
@graphql:query bot, you can visit our RDA (Robotic Data Automation) bot docs site, which is an extensive resource containing bot models, example pipelines, formatting templates, user guides, and more.
Cato Networks GraphQL Query Example
Refer to the full GraphQL query in a formatting template
Cato Networks Pipeline Example
Following is an example pipeline that constructs the GraphQL query payload, with dynamic data substitution and passes data to GraphQL bot
About Formatting Templates
A Formatting Template allows you to construct rich-text payloads (json/markup/markdown/html/grapqhql/sql etc.) with dynamic substitution of data from an input data in the pipeline. This allows you to easily build your desired payload and send it to pretty much any API endpoint. It is a very powerful feature and uses Jinja2 templating engine. We use this feature extensively to enable our expansive list of integrations.
Monday.com Example with GraphQL Bot
template_col = "query"
Monday.com GraphQL Query Example:
Monday.com Pipeline Example
The following example pipeline uses the above formatting template and sends a query to Monday.com
Want to Try It Out? For Free?
Simply signup for a free account on cfxCloud – our fully managed cloud-based SaaS offering. Here you have access to a library of 800+ bots, a self-service low-code studio, a no-code drag & drop pipeline designer, and cfxEdge to ingest/integrate data from on-prem or remote/satellite environments.