GraphQL Execute

Use the GraphQL Execute policy to execute a GraphQL query by using sub-queries.

Gateway support

Table 1. Table showing which gateways support this policy, and the corresponding policy version
Gateway Policy version
DataPower® API Gateway 2.0.0 (DataPower API Gateway Version 10.0.4.0 and later)

2.1.0 (DataPower API Gateway Version 10.5.2.0 and later)

This topic describes how to configure the policy in the assembly user interface; for details on how to configure the policy in your OpenAPI source, see graphql-execute.

About

The GraphQL Execute policy executes a GraphQL query by using sub-queries. The policy splits up the original GraphQL query into different sub-queries that can then be processed in different ways. The GraphQL Execute policy supports the following four different sub-queries as targets:
  1. root; contains the core GraphQL query that you want to invoke on the backend.
  2. __introspection; contains the introspection query that can be processed locally on the DataPower API Gateway without having to invoke the backend.
  3. __rateLimit; contains the __rateLimit query that specifies the different rate limit data that you want to receive.
  4. __cost; contains the __cost query that specifies the different cost data that you want to receive. This query must be in the format that is specified in the IBM GraphQL Cost Directives specification, see Introspection of Cost Analysis Results: __cost.
The root, __rateLimit, and __introspection targets can be executed in any order, or at the same time. The __cost target can be executed at any time if no response data is expected. If response data is expected, then the __cost target is executed after the root target in order to accurately return correct response cost data. After all the targets are executed, the GraphQL Execute policy combines all of the responses together. To enable the responses of the individual targets to be correctly merged with each other into a final, single response, the GraphQL Execute policy must include all of the introspection types that are associated with each level of the response data.

Properties

The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.

Table 2. GraphQL Execute policy properties
Property label Required Description Data type
Title No The title of the policy.

The default value is graphql-execute.

string
Description No A description of the policy. string
Target No The target for the sub-queries. Valid values are:
  • root; contains the core GraphQL query that you want to invoke on the backend.
  • __introspection; contains the introspection query that can be processed locally on the DataPower API Gateway without having to invoke the backend.
  • __rateLimit; contains the __rateLimit query that specifies the different rate limit data that you want to receive.
  • __cost; contains the __cost query that specifies the different cost data that you want to receive. This query must be in the format that is specified in the IBM GraphQL Cost Directives specification, see Introspection of Cost Analysis Results: __cost.
string