GraphQL API
Overview
Graphic Query Language (GraphQL) is a language created for use with APIs. It works as an alternative to REST APIs, allowing you to get data according to your needs. GraphQL gives you autonomy to request the data you want and receive exactly what you asked for through a JSON result.
As GraphQL fetches information differently from traditional APIs, it assists you in filtering data without overfetching. The precise response it provides also gives a better performance to those using GraphQL and makes it easier to use. Another difference from other APIs is that it has a single endpoint.
Having in mind clients who want to request and visualize their data with easy and improved performance, Azion now provides support for GraphQL. You can use the API to maximize the use of your data accessed through Real-Time Metrics, which provides you with real-time access to metrics so you can optimize all of your potential, and Real-Time Events, which provides data in real time so you can perform complex searches to explore your information.
You can also check all Azion Observe products: Data Streaming and Edge Pulse.
You don’t need a specific database, framework, or programming language to use GraphQL. You can use it with the code and data you’re already used to. The API relies on queries to access your data and information and filter what you need. Even if you’ve already made a request, you can change, delete, or add more information with a simple modification in your query.
Here’s an example of what a query looks like:
query HttpQuery {
httpMetrics(
filter: {
tsRange: {begin: "2022-03-21T10:10:10", end: "2022-09-23T10:10:10"}
}
)
{
ts
geolocCountryName
geolocRegionName
}
}
And here’s an example of what the JSON response will look like:
{
"data": {
"httpMetrics": [
{
"ts": "2022-10-21T15:00:00Z",
"geolocCountryName": "Canada",
"geolocRegionName": "Quebec"
},
{
"ts": "2022-10-21T14:00:00Z",
"geolocCountryName": "Brazil",
"geolocRegionName": "Parana"
}
]
}
}
By using queries in Azion GraphQL API, you can request both raw and aggregated data. If you request the aggregated data model, the API will fetch your data according to a predefined interval of minutes, hours, or days.
Didn’t find what you were looking for? Open a support ticket.