Using GCP Apigee Proxy with GraphQL

54 Views Asked by At

Using GCP Apigee Proxy, we can create the necessary facade API Proxies that connect to an HTTP backend.

If I understand correctly, GCP Apigee also supports GraphQL through GraphQL policies.

Based on the documentation https://cloud.google.com/apigee/docs/api-platform/reference/policies/graphql-policy - we can use the GraphQL policy to Associate GraphQL with API products.

My question is as follows: can we use the GCP Apigee GraphQL policy to declare logic that analyzes the GraphQL payload from the request, redirecting various parts of it to different REST API endpoints previously created with GCP Apigee Proxy, gather responses from these REST endpoints, and send them back to the client in response to the GraphQL query?

1

There are 1 best solutions below

0
iamwillbin On

To answer your question, Yes.

You can use the GCP Apigee GraphQL policy to declare logic that analyzes the GraphQL payload from the request, redirecting various parts of it to different REST API endpoints previously created with GCP Apigee Proxy, gather responses from these REST endpoints, and send them back to the client in response to the GraphQL query.

The GraphQL policy in Apigee can parse GraphQL request payloads into message flow variables, verify the request against a GraphQL schema, or both. It allows you to ensure that your APIs only process requests that conform to the provided schema, impose restrictions on the payload, and associate GraphQL with API products based on the documentation that you posted.

By adding the GraphQL policy to your API proxy and attaching it to the appropriate steps in the message flow, you can achieve this functionality, see this link.