·¬ÇÑÉçÇø

CMS resources
Technology insights
Back to Technology insights

What is GraphQL?

image of GraphQL logo for GraphQL query article

GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data, providing an alternative to the traditional RESTful style of web services. Here are some common questions about GraphQL—and how Brightspot helps solve them.

Headless CMS
Download this e-book for a technical buyer’s guide to headless CMS architecture and the GraphQL query language.

GraphQL is a query language—hence the "QL"—used for APIs, plus a runtime environment for fulfilling the respective queries with data. In short, a GraphQL query is designed to provide data from a server—or many servers—to a client-side application, whether that’s a website, app or some other connected device. Some of the main benefits to GraphQL queries include enabling the client to specify exactly the data it needs; aggregation of different data across multiple sources; and a self-describing type system that helps clients discover which data types and fields are accessible from the API (likewise, if a new field is added to a content type, for example, the GraphQL schema will automatically reflect it).

graphic showing snipper of GraphQL code

Everything you need to know about GraphQL

Here are some common questions about GraphQL—and how Brightspot helps solve them.

What is GraphQL?

GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data, providing an alternative to the traditional RESTful style of web services. Whereas RESTful style tends to have looser guidelines for how an API should be structured, GraphQL strictly structures the communication between the client and the server, irrespective of the specific data models used. GraphQL’s self-describing type system enables automation in the case of changes to the content data model. Originally created at Facebook in 2012, a public GraphQL API specification was created in 2015 and has since become an open standard.

What are the advantages of GraphQL?

  • Bring your own data and code: Because GraphQL is simply a specification of how an API should work, there is no limitation on the client or server languages used to implement it. There are already several libraries written in a variety of languages to help you get started.
  • Ask for what you need, and get exactly that: GraphQL is useful for content types, like Article, that contain numerous input fields. If one App needs two fields while another needs 10, you don’t need multiple API endpoints—the app that only needs two fields only gets two fields, and the same for the App that needs 10.
  • Get many resources in a single request: When dealing with complex data relationships, REST APIs usually require loading data from multiple URLs to gather all data; GraphQL, on the other hand, get all the data your app requires in a single request.
  • Describe what’s possible with a type system: GraphQL has a self-describing type system, enabling clients to easily discover what data types and fields are accessible from the API.
  • Move faster with powerful developer tools: There are a myriad of development tools for writing and sending GraphQL queries. Because of GraphQL’s self-describing type system, you also benefit from features like auto-complete. Brightspot has actually embedded a developer tool called GraphiQL directly within our platform. 
  • Evolve your API without versions: GraphQL enables you to add new fields and deprecate old ones without impacting existing queries.

Does GraphQL make multiple requests to get data?

No. Unlike RESTful APIs, GraphQL gets all data that your App requires in a single request.

Does GraphQL force me to version my APIs?

No. GraphQL enables you to add new fields and deprecate old ones without impacting existing queries, effectively only needing one version.

Can you use your own data and code with GraphQL?

Yes. Because GraphQL is simply a specification of how an API should work, there is no limitation on the client or server languages used to implement it. There are already several libraries written in a variety of languages to help you get started.

How do I write a GraphQL query?

To see a developer write GraphQL queries in real time, check out our featuring Brightspot’s head GraphQL specialist, Omavi Walker.

Is GraphQL faster than REST?

Since RESTful APIs usually require loading from multiple URLs, GraphQL is faster since it gets all data from a single request.

How does Brightspot use GraphQL?

Brightspot’s ecosystem consists of many content types with complex but useful relationships. Unlike typical REST APIs, GraphQL helps us enable you to get all the data you need in a single request instead of having to load data from multiple URLs.

Like GraphQL, Brightspot has a self-describing type system, enabling clients to easily discover what data types and fields are accessible from the API. In Brightspot, for example, if a new field is added to a content type, the editorial user interface for that type also updates so that an editor can publish that new field. Our GraphQL implementation takes this functionality a step further by ensuring the GraphQL schema and user interface remain in sync. In other words, if a new field is added to a content type, it will automatically be reflected in the GraphQL schema that we generate.

8-Headless-GraphQL APIs.jpg

GraphQL enables you to add new fields and deprecate old ones without impacting existing queries, and Brightspot translates deprecated data model types and fields directly into deprecated versions of their GraphQL counterparts, giving apps continuous access to new features from the platform.

Because GraphQL doesn’t limit the client or server languages that are used to implement it, it enables Brightspot to express our existing Brightspot type and view systems as GraphQL schemas.
Headless CMS
To see a developer write GraphQL queries in real time, check out our GraphQL webinar featuring Brightspot’s head GraphQL specialist, Omavi Walker.
Start building in a free trial environment, see a demo or talk to an expert—select one of these paths and start however you would like to!

Tags
Share

Related resources

An API-first CMS provides the advantages of headless CMS—API-only—with rich capabilities like workflow, search and content delivery. With an API-first platform, businesses have the option to use a number of pre-built integrations to save valuable development time and effort.
Learn how Brightspot’s GraphQL-powered platform gives you the ultimate flexibility to develop your own front-end solutions and helps you manage modular content across channels and endpoints.
Everything you need to know about the advantages of GraphQL and how GraphQL queries work
Discover the pros and cons of a headless CMS with GraphQL and learn how Brightspot has developed innovative solutions to tackle four primary issues associated with it.
GraphQL is a query language that enables the connection of programming APIs that enable headless CMS integrations like those possible through the Brightspot CMS. For digital-media teams, GraphQL supports two of the most important factors in content development: speed and flexibility.
GraphQL is the programming language that enables flexible connection with programming APIs that support headless CMS integrations like the one offered through Brightspot.
Let us give you a demo
Hear how Brightspot can turn your digital strategy goals into a reality and see how the lives of your content creators and developers will be changed using our platform.


Request Demo