Test your queries

Abstract

Learn how to use the Delivery API IDE and the GraphQL testing UI for testing your queries.

The GraphQL IDEs help you test GraphQL queries before you use them in your application. There is a GraphQL IDE built on top of the Preview API (the Preview API IDE) and the Delivery API (the Delivery API IDE) with additional features such as automatic schema reloading. Before you can use the Delivery IDE and the Preview IDE, you must create an API key.

The Delivery API IDE uses the Delivery API. The Delivery API is a GraphQL API that is hosted on the Delivery Platform and provides access only to approved and published content. You must authenticate with an API key for all requests to the Delivery API. Use OAuth to obtain a JWT before you create an API key.

When you have access to the GraphQL endpoint, you can run queries and see, for example, what kind of objects you can access, what type of attributes they have, and so on. The URL of the IDE of the Delivery API is https://edge.sitecorecloud.io/api/graphql/ide.

Figure 2. The Delivery API IDE
The Delivery API IDE

Test your queries for approved and published content on the Delivery API IDE.



The Preview API IDE provides the same functionality as the Delivery IDE, but it executes against the Preview API on your self-hosted Sitecore XM instance. You can use the Preview endpoint testing UI to test your queries. The Preview endpoint (/sitecore/api/graph/edge) on your self-hosted Sitecore XM instance is enabled by default. However, you must create an API key and pass it with your GraphQL request.

To test your queries:

  1. Go to: https://<your host>/sitecore/api/graph/edge/ui

  2. In the HTTP Headers section of the UI, specify the sc_apikey header.

    {
    2    "sc_apikey": "your-api-key-guid"
    3}

    Note

    Sitecore Services Client and Sitecore GraphQL also accept API keys through a query string. We recommend you use the sc_apikey HTTP header because this mirrors the behavior of Experience Edge.