Use GraphQL protocol

Overview

GraphQL is a high-performance query language for working with RESTful API services. The GraphQL protocol is integrated with the existing user interface for managing web services in Sitefinity CMS backend. When creating a web service, you have to specify the protocol that this service uses.

NOTE: All settings for authentication, Cross-Origin Resource Sharing (CORS), exposed types and fields, as well as the restrictions for them are respected in both OData and GraphQL protocols. 

Install the GraphQL NuGet package

As of release Sitefinity CMS 14.3, GraphQL is included in Progress.Sitefinity.All NuGet package that installs Sitefinity CMS.
GraphQL is also distributed as an optional package, which you install if you have upgraded your project to release 14.3 and want to enable the protocol. In that case, perform the following:

  1. Download Progress.Sitefinity.GraphQL NuGet package from Sitefinity CMS NuGet packages repository.
  2. Install the package in your Sitefinity CMS project.
  3. Build and run your project.

Create a GraphQL web service

You must create a new web service by following procedure Create a RESTful API service.
In Protocol dropdown box that lists the available protocol options, make sure to select GraphQL.
Once you are done with the procedure, you are navigated back to the Web services grid and a GraphQL link is displayed.

Browse the GraphQL web service

The GraphQL web services that are exposed through Sitefinity CMS, come with an introspection schema that allows third-party tools to integrate and browse the schema.
After you create the GraphQL service, you can browse the schema at api/{urlofservice}/graphql using third-party tools, such as:

  • GraphiQL explorer
  • Postman

For more information, see GraphiQL explorer example on GitHub.
For information about using Postman, see Postman documentation » GraphQL overview.

NOTE: When using third-party tools that have a web interface, make sure to set the Allow access from other domains property of the service (CORS). 

Limitations

The current implementation of GraphQL only supports queries. The GraphQL web services are read-only and do not support mutations.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?