GraphQL support

Moesif supports GraphQL APIs throughout the platform. However there are a few differences compared to other APIs such as REST and RPC. The most obvious difference is that unlike REST APIs, GraphQL APIs usually have only a single route

Moesif will parse your GraphQL operations into its respective components so that you can filter and segment by particular resources fetched or variables in your query. In fact, the flexible and detailed queries brought by GraphQL makes Moesif’s API Analytics even more powerful.

GraphQL over HTTP

There are four different ways GraphQL can be transported over HTTP which Moesif supports.

  1. If the application/graphql Content-Type header is present, the HTTP request body contents is treated as the GraphQL query string itself.
      human(id: "1000") {
     height(unit: FOOT)
  2. The GraphQL query string is specified in the ?query= query string when receiving a HTTP GET request.

  3. A standard GraphQL POST request which uses the application/json content type includes a JSON-encoded request body of the following form: json { 'query': '...', 'operationName': '...', 'variables': { 'myVariable': 'someValue', ... } }

  4. Alternatively, the GraphQL query string is specified in the ?query= query string when receiving a HTTP POST request.

Filters and segmentation

If Moesif detects a GraphQL request, you will see the parsed AST underneath request.graphql.XXX

GraphQL Filtering

You can select any attribute in your GraphQL operation such as a specific query field name or argument value.

Bucketing and alerting on errors

Moesif will support matching on specific operation names and operation types to bucket a particular type of API call. This ensures you don’t just have a single bucket under the route POST /graphql.