# Use the GraphQL Explorer and the SDK On this page, we will look in more detail at sending GraphQL requests. We'll explore two options: one using the GraphQL Explorer in the Merchant Center, and the other using the SDK. ## GraphQL Explorer The [GraphQL Explorer](/merchant-center/developer-settings.md#graphql-explorer) is a built-in IDE in the Merchant Center for running GraphQL queries and mutations against your Project. To access it, go to **Settings** > **Developer settings** and click the **GraphQL Explorer** tab. The GraphQL Explorer provides a query editor with autocomplete, a results window, and a Documentation Explorer for browsing the schema. Additional features include query prettification and history. For a full walkthrough of the interface, see [GraphQL Explorer](/merchant-center/developer-settings.md#graphql-explorer) in the Merchant Center documentation. ## Use the SDKs How can we begin to use GraphQL in our code? Just like our commercetools SDKs provide help in using the REST APIs, they also provide [help in using GraphQL](https://commercetools.github.io/commercetools-sdk-java-v2/javadoc/com/commercetools/docs/meta/GraphQL.html). For additional SDK examples, including TypeScript, Java, and .NET, see [Using an SDK](/api/graphql.md#using-an-sdk) in the GraphQL API reference. See our examples below for creating the Customer query using `sort` and `where` parameters that we explored earlier. ```typescript const query = ` query { customers(where: "firstName=\\"Martha\\"", sort: "id asc" ) { results { firstName lastName email } } } `; async function customerFetch() { try { const response = await apiRoot .graphql() .post({ body: { query } }) .execute(); console.log('Success', JSON.stringify(response.body, null, 2)); } catch (error) { console.log(JSON.stringify(error, null, 2)); } } customerFetch(); ``` The commercetools Java SDK has a module that provides GraphQL support. It generates a type-safe query and projection builder. Results can be mapped to the correct response type. ```java GraphQLResponse response = client .graphql() .query( GraphQL .customers(query -> query .sort((Collections.singletonList("id asc"))) .where("firstName=\"Martha\"") ) .projection(root -> root.results().firstName().lastName().email()) ) .executeBlocking() .getBody(); logger.info("Total Customers: " + response.getData().getTotal()); logger.info("First" + "\t" + "Last" + "\t" + "Email"); logger.info("-----" + "\t" + "----" + "\t" + "-----"); response .getData() .getResults() .forEach(result -> logger.info( result.getFirstName() + "\t" + result.getLastName() + "\t" + result.getEmail() ) ); client.close(); ``` Which outputs the following (modified to remove some logger info): ```json { "data": { "customers": { "results": [ { "firstName": "Martha", "lastName": "Jones", "email": "martha@example.uk" }, { "firstName": "Martha", "lastName": "Schmidt", "email": "martha@example.de" }, { "firstName": "Martha", "lastName": "Robinson", "email": "martha@example.com" } ] } } } ``` ## Related pages - [Area overview page with navigation](/learning-developer-essentials.md) - [Previous page: Develop with GraphQL](/learning-developer-essentials/graphql/develop-with-graphql.md) - [Next page: Create a GraphQL query](/learning-developer-essentials/graphql/create-a-graphql-query.md)