The servers option sets the GraphQL endpoints that the Try it button sends requests to. The Try it button on GraphQL query and mutation samples opens Replay, where users can edit the operation and send it. Replay lists each endpoint as an environment, so users can switch between endpoints such as production and sandbox. Without servers, Replay uses the address of your documentation site, and users have to type the endpoint before they send a request.
This is a feature in early access. It may not be available for your organization yet, and its behavior may change before general availability.
To request access to this feature, contact our Support team.
The servers setting is not available in Redoc Community Edition.
| Option | Type | Description |
|---|---|---|
| servers | [Server object] | List of GraphQL endpoints for the Try it button. A list in an API entry replaces the list under the root graphql key. |
| Option | Type | Description |
|---|---|---|
| url | string | REQUIRED. Full URL of the GraphQL endpoint, including the path, for example https://api.example.com/graphql. The URL must start with http:// or https://. |
| description | string | Name of the endpoint in Replay. Replay shows the URL when you don't set a description. |
The following example adds a production and a sandbox endpoint to every GraphQL API in the project:
graphql:
servers:
- url: https://api.example.com/graphql
description: Production
- url: https://sandbox.example.com/graphql
description: Sandbox
The following example sets the endpoint for the library API only. The list replaces the root graphql.servers list for this API:
apis:
library@v1:
root: ./graphql/library.graphql
graphql:
servers:
- url: https://library.example.com/graphql
description: Library API
- GraphQL - Official GraphQL specification and documentation for understanding query language fundamentals
- Configuration options - All the other options for your project
- hideReplay - Hide the
Try itbutton when you don't want users to send requests from the docs - corsProxyUrl - Choose the proxy that Replay uses for cross-origin requests to your endpoints
- GraphQL configuration - All the options you can set under
graphql - Replay API explorer - How users test APIs from the reference docs