---
updatedAt: 2025-05-13T12:34:21.000Z
agentTools:
  projectIndex: https://learn.vtex.com/llms.txt
---

# GraphQL: Using GraphiQL

<HTMLBlock>{`
<style>
      section#hub-content header h1, section#hub-content header h2 {
        color: #f71963
      }
    
      p {
        line-height: 1.5rem;
      }
    </style>
`}</HTMLBlock>

# GraphQL: Using GraphiQL

## Introduction

Now, with the query and resolver implemented, we need to use it to retrieve the *top n* most viewed products. By using the **GraphQL IDE**, we can test the query we implemented before.

## GraphiQL

[GraphiQL](https://github.com/graphql/graphiql) is a graphical interactive in-browser GraphQL IDE. Before using the query in the app, it is interesting to test its functionality. To do so, we will reproduce your query usage in the GraphQL IDE.

Exploring the IDE interface, there are three main areas: the coding area, the query variables area and the debug area. Check where each shows up in the interface in the image below.

![image](https://user-images.githubusercontent.com/43679629/83764107-e900ea80-a64f-11ea-969f-116ea896fe2d.png)

## Testing your query

1. Open the GraphiQL route and type the code below in the coding area:

   ```
   query ($topN: Int) {
     productList(topN: $topN){
       slug
       count
     }
   }
   ```

2. The query that we just declared uses a variable (*topN*). Now we need to declare it in the *Query Variables* area:

   ```
   {
     "topN": 2
   }
   ```

   > :exclamation: The *Query Variables* area is below the coding area, to amplify its area just drag by the title.

3. At last, just click on the *play* button and check the outcome on the debug area. The query results should look like this:

   ![image](https://user-images.githubusercontent.com/43679629/83763622-4c3e4d00-a64f-11ea-9615-435811d411c6.png)

<HTMLBlock>{`
<div id="finished-course">
  <div class="finish-elems"><b class="rebelPink">Congratulations</b>, you finished the course!</div>
  <img class="finish-elems" src="https://media.giphy.com/media/g9582DNuQppxC/giphy.gif"/>
  
  <div class="finish-elems">Still have time left?</div>
  <a class="finish-elems" href=course-service-course-challenge-lang-en>Try our challenge for this course!</a>

</div>
`}</HTMLBlock>

<HTMLBlock>{`
<div id="finish-course">
  <a id="finish-link" href="/page/learning-path-lang-en">Finish Course</a>
</div>
`}</HTMLBlock>

<hr/>
<div id="contribute-container">
  <p id="contribute-title"> 
    Help us make this content better!
  </p>
  <p id="contribute-description">
    VTEX IO courses are open source. If you see something wrong, you can open a pull request!
  </p>

  <a id="contribute-button" href="https://github.com/vtex/vtex-courses/edit/master/courses/service-course/steps/08_graphiql/en.md">
    Make a contribution
  </a>

  <p id="contribute-issue">
    or <a href="https://github.com/vtex/vtex-courses/issues/new/choose">open an issue</a>
  </p>

</div>