Explore the GraphQL UI
Use the Gloo UI to review the health and configuration of your GraphQL APIs and test out your GraphQL API functionality.
List GraphQL APIs in the Gloo UI
The Gloo UI is served from the
gloo-mesh-ui service on port 8090. You can connect by using the
kubectl CLIs. For more information about using the Gloo UI, see the observability documentation.
- Open the Gloo UI.
For more information, see the CLI documentation.
- Port-forward the
gloo-mesh-uiservice on 8090.
kubectl port-forward -n gloo-mesh svc/gloo-mesh-ui 8090:8090
- Open your browser and connect to http://localhost:8090.
- Port-forward the
- Optional: If authentication is enabled, sign in.
- In the navigation bar, click APIs. The GraphQL APIs in your Gloo environment are listed.
- Review the overview details for each API, such as the cluster and namespace it is deployed in, the route table that exposes the API, and the current status of the API.
Review GraphQL API details
Review the details of a GraphQL API, including its configuration, the resolvers for each query, and more.
- Click the name of a GraphQL API from the list of APIs.
- In the API details page, you can view the raw configuration files, or explore the details of the route table, destinations, schema, and resolvers for the API.
- Route table and destinations: Click the View YAML button to view the raw configuration of the route table. You can also see which destination services the route table is applied to in the Applied to Destinations pane at the end of the page.
- Schema and resolvers: In the Schema pane, click the View SDL button to view the raw configuration of your GraphQL schema. You can also use the Query and Object tabs to click through information about the defined queries, their resolver configurations, and the objects that they apply to.
Try out GraphQL APIs
Explore the functionality of an API by sending sample queries.
To use the explorer feature, you must first apply a CORS policy on your GraphQL route. This example CORS policy applies to any route that has the
graphql: "true" label.
kubectl apply -f - <<EOF apiVersion: security.policy.gloo.solo.io/v2 kind: CORSPolicy metadata: name: graphql-explorer namespace: bookinfo spec: applyToRoutes: - route: labels: graphql: "true" config: allowCredentials: true allowHeaders: - content-type allowMethods: - POST allowOrigins: - regex: ".*" EOF
After you apply the policy, follow these steps in the GraphQL UI.
- From the APIs overview page, click the name of a GraphQL API schema.
- Click the Explore API button.
- In the API Explorer panel, which uses GraphiQL, you can specify example requests to send to the GraphQL API.
- Click the > Explorer button to expand the Explorer panel. This autocomplete feature helps populate sample GraphQL queries based on the fields that are defined in the API configuration. For example, you might select one of your defined queries, and the fields within the query that you want data for.
- Click Run, which sends the request, and returns the response in the middle panel.
- You can also explore the documentation for the API by clicking the < Docs button to expand the Documentation Explorer panel.