Test your queries

Test your queries

You can test your GraphQL queries on real Prepr data using the API Explorer tool. Check out this article to learn more.

⚠️

Before using the API Explorer, make sure to upload demo data during the onboarding or to complete the initial setup of your Prepr environment.

Prepr provides you with an interface based on the Apollo Explorer to test your requests before integrating them into production. Within the API Explorer, you can write and validate your GraphQL queries, make a test run of the queries, and receive responses from the Prepr API straightaway.

You can open the API Explorer in two ways.

From the Access token details page:

  1. Navigate to Settings → Access tokens and click on the desired access token record to open its details.
  2. On the Access token details page, click Open in API Explorer under the API URL field.

Access token details page

From the Content item details page:

  1. Navigate to the Content tab and click on the desired content item record to open its details.
  2. On the Content item details page, click Open in API Explorer in the sidebar on the right.

Use this option if you want to try out the query request for a particular content item.

Content item details page

Whatever option you choose, you’ll be redirected to the API Explorer interface similar to this:

API Explorer overview

Your API endpoint URL and schema will be registered in the API Explorer automatically, so you are ready to go.

  1. Use the Operation pane to compose a query.

  2. On the left of the Operation pane, you will see the Documentation pane that shows all the fields and arguments available in your schema. Click the plus icon next to the needed element to add it to your query.

  3. (Optional) In the lower part of the Operation pane, there are two additional tabs – Variables and [Headers(/graphql-api/api-basics#the-headers), where you can specify dynamic arguments and key-value pairs accordingly.

  4. Once you’ve built your query, click Run.

  5. Check the API response in the Response pane on the right. The response is available in both an interactive JSON and table format. You can also copy the response to your clipboard, download it as a CSV, or download the JSON.

  6. If the query results suit you, copy the query to implement it into your production easily.

Learn more about the API Explorer in the Apollo documentation (opens in a new tab).

Was this article helpful?

We’d love to learn from your feedback