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 meshctl or kubectl CLIs. For more information about using the Gloo UI, see the observability documentation.

  1. Open the Gloo UI.

    For more information, see the CLI documentation.

    meshctl dashboard
    
    1. Port-forward the gloo-mesh-ui service on 8090.
      kubectl port-forward -n gloo-mesh svc/gloo-mesh-ui 8090:8090
      
    2. Open your browser and connect to http://localhost:8090.
  2. Optional: If authentication is enabled, sign in.
  3. In the navigation bar, click APIs. The GraphQL APIs in your Gloo environment are listed.
  4. 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.
Figure: GraphQL APIs overview

Review GraphQL API details

Review the details of a GraphQL API, including its configuration, the resolvers for each query, and more.

  1. Click the name of a GraphQL API from the list of APIs.
  2. 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.
Figure: GraphQL API details page

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.

  1. From the APIs overview page, click the name of a GraphQL API schema.
  2. Click the Explore API button.
  3. In the API Explorer panel, which uses GraphiQL, you can specify example requests to send to the GraphQL API.
  4. 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.
  5. Click Run, which sends the request, and returns the response in the middle panel.
  6. You can also explore the documentation for the API by clicking the < Docs button to expand the Documentation Explorer panel.