What is GraphQL API?

GraphQL is a new way to address many pain points for application developers; all GraphQL servers adhere to a specification, which features patterns that make it easier to build complex experiences across a wide variety of platforms and devices.

Salesforce GraphQL API is available in Enterprise, Performance, Unlimited, and Developer Editions. It adheres to the June 2018 version of the spec.

The following benefits are available for Salesforce developers, including:

  • Field selection
  • Resource aggregation
  • Schema introspection

The first of these patterns is field selection, which requires the client generating the GraphQL query to explicitly declare which fields they would like to receive in the response. This technique reduces the size of the payload, as the client only receives fields that were included in the query.

The second pattern is aggregation, which allows the client to specify a traversal across the fields in the GraphQL schema. Aggregations reduce round trips between the client and server, returning a set of related resources within a single response.

The final pattern is introspection, which is the ability to send a query to the GraphQL server to ask questions about the types, fields, and their relationships within the schema. When all these patterns are combined, it results in more responsive, higher-quality applications.

GraphQL API adds even more features:

For more information on getting started with GraphQL API, we recommend these resources.