Reduce complexity with Kontent’s native GraphQL API
We’re always improving Kontent by Kentico to enable strategists, creators, and developers alike! See how our GraphQL API helps support the creation of powerful digital experiences.
Jordan TorpyPublished on Nov 18, 2021
In the world of Headless CMS, all of your content is separated from its presentation. This gives you lots of flexibility. But it also means that when you want to show some content (on a web page, in an app, or somewhere else), you need to ask for what you need from Kontent. This request is handled through an API.
Starting today, Kontent users have a new option for fetching their content: our native GraphQL API. Developers like to work with GraphQL because it can help speed up development time, improve site and app performance, and reduce the complexity of their work. Sounds good, right? Let’s take a closer look at how it does that.
What is GraphQL, and why is it important?
GraphQL is a query language that you can now use to request data from Kontent, using our GraphQL API.
Imagine you’ve got an online supermarket. You manage the content for your store using Kontent by Kentico. When a customer visits the “Produce” section on your site, that page needs to fetch the latest product information from your Kontent project. It makes this request by using a Kontent API.
There are now two options for how this request can be made:
- Through the RESTful Delivery API
- Through the GraphQL API
Using the GraphQL API can provide some serious advantages to businesses: better site and app performance, an improved developer experience, and support for modern tooling. Read on to find out how.
More efficient data querying
With the GraphQL API, you can ask for exactly what you need. Nothing more, nothing less. This is a big improvement over a RESTful API.
When requesting data using a RESTful API, you send a request to a specific endpoint. The endpoint you choose depends on the exact data you need. For example, if you wanted to get a specific content item, you would send a request to an endpoint that used that content item’s ID number.
If you wanted to get several specific content items, that would require several different requests. That’s not necessarily a bad thing, but when you start working on sites or applications that serve millions of users, you can run into some problems of scale pretty quickly.
With a GraphQL API, you can query for any number of items with just one request. That’s because GraphQL doesn’t require you to make a request to a specific endpoint. Instead, you create a request using the GraphQL API, and it fetches the resources for you.
That means GraphQL makes data queries more efficient, saving both computing and developer time.
Supporting a modern developer experience
GraphQL is a vendor-agnostic query language. If a developer has experience with GraphQL, they can take that experience with them to a new job and hit the ground running.
Due to its efficiency and flexibility advantages over RESTful APIs, many modern frameworks are better suited to working with GraphQL. Choosing a headless CMS with a GraphQL API can help keep the whole technology stack future-proofed and ensure developers have the opportunity to work with their preferred best-of-breed tools.
Get started with the Kontent GraphQL API
The GraphQL API can manage all content delivery requests that can be accomplished with the Delivery API. You can edit and test your queries using your choice of IDE or use GraphiQL, an embedded graphical user interface for GraphQL. For a full breakdown of what’s available and how to get started, read the technical documentation here. For a more in-depth look at GraphQL from a developer's perspective, take a look at our technical blog from our Developer Evangelist.
With the GraphQL API, look forward to more efficient queries, happier developers, and the ability to create brilliant digital experiences.