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.
Install the GraphQL NuGet package
GraphQL is not included in the default installation of Sitefinity CMS version 14.2. It is distributed as an optional package, which implements the integration. To enable and set up GraphQL, perform the following:
- Download
Progress.Sitefinity.GraphQL
NuGet package from Sitefinity CMS NuGet packages repository.
The NuGet package is in prerelease state, so make sure that you filter by prerelease packages.
- Install the package in your Sitefinity CMS project.
- 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 creating a GraphQL service, you can browse the schema at (api/{urlofservice}/graphql)
using third-party tools, such as:
- GraphiQL explorer
- Postman
For 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 web service (CORS).
Limitations
The GraphQL protocol implementation in Sitefinity CMS only supports queries. The GraphQL web services are read-only and do not support mutations.