Working with Graph Explorer

Graph Explorer is a developer tool that lets you conveniently make Microsoft Graph REST API requests and view corresponding responses. This article describes how to use some of the important features in Graph Explorer.

The user or administrator must grant Graph Explorer the correct permissions via a consent process to access data in Microsoft Graph. Consent to permissions in Graph Explorer either via the Modify permissions tab or the Select permissions option in the settings gear next to your profile when you’re signed in. The Modify permissions tab lists all permissions you need to run the query in the address bar.

To consent to permissions:

  1. Select a sample query and run it.
  2. Select the Modify permissions tab.
  3. See the list of permissions required to run the query.
  4. Select the consent button next to the permission you want to consent to.

Screenshot of Graph Explorer with the steps to consent to permissions highlighted

The Modify permissions feature is currently in preview, and some queries might be missing permissions. If permissions are missing for a query, the Select permissions option in the settings gear next to your profile contains the list of all available permissions:

  1. Go the settings gear and click the Select permissions option. This option contains the list of all available permissions.
  2. From the list of all the permissions, consent to the ones you want.

Screenshot of Graph Explorer with the Select permissions option highlighted

Get an access or authentication token

Graph Explorer includes an Access token tab that shows your access token when you are signed in. On the Access token tab, you can copy the token if you need to use it in your favorite REST client application.

Screenshot of the Access token tab in Graph Explorer with the Copy button highlighted

Copy code snippets

For each REST API query you select or enter in Graph Explorer, you can find how to call that API in each of the four languages showcased under the Code snippets tab - C#, Java, JavaScript, and Objective-C.

Screenshot of Graph Explorer with the code snippets tab highlighted

UI component integration

Graph Explorer includes several features to make implementing UI easier. Reuse these components in your apps too.

Microsoft Graph Toolkit integration

The Microsoft Graph Toolkit is a collection of reusable, framework-agnostic web components and helpers for accessing and working with Microsoft Graph. The components are fully functional, with built in providers that authenticate with and fetch data from Microsoft Graph.

Graph Explorer provides sample REST API queries that correspond to Microsoft Graph Toolkit components. A blue dot on the Toolkit component tab indicates that the Toolkit provides a component for the currently specified REST API query in Graph Explorer. You can conveniently copy the code for the component to your app.

The following table lists the sample queries that currently include a Toolkit component.

Graph Explorer sample query Toolkit sample iFrame URL
GET my profile https://mgt.dev/iframe.html?id=components-mgt-person-card—person-card-hover
GET people I work with https://mgt.dev/iframe.html?id=components-mgt-people—people
GET all my planner tasks https://mgt.dev/iframe.html?id=components-mgt-tasks—tasks
GET my events for the next week https://mgt.dev/iframe.html?id=components-mgt-agenda—get-events-for-next-week
GET my photo https://mgt.dev/iframe.html?id=components-mgt-person—person-photo-only

Screenshot showing the Toolkit components tab with the code to generate the component highlighted

Adaptive cards integration

Adaptive cards are platform-agnostic snippets of UI, authored in JSON, that apps and services can openly exchange. When you run a query and an adaptive card is available, a blue dot appears on the Adaptive cards tab.

Screenshot of the adaptive cards tab in Graph Explorer with the response details highlighted

Customize the theme in Graph Explorer

Choose the theme for Graph Explorer by selecting the Change theme option under the settings gear. Theme options are Light, Dark, and High contrast.

Screenshot of the Change theme option in Graph Explorer with the theme options highlighted

Storing and sharing queries

Queries run in Graph Explorer are saved for 30 days in the History tab. On the History tab, you can:

  1. Export all history items in .har format.
  2. Delete all history items.
  3. View this history item.
  4. Run this query.
  5. Export this history item in .har format.
  6. Delete this history item.

Screenshot of the History tab with options highlighted

To share queries that you run, click the share query button in the response pane and click copy. This copies a link to share and allow others to see your query and the results.

Screenshot of Graph Explorer with the Share and Copy options highlighted

Graph Explorer UI features

Collapse and expand the sidebar component in Graph Explorer when you want to widen the request and response area. To collapse the sidebar component, select the hamburger icon on the top left of the sidebar.

Screenshot of Graph Explorer with the expand and collapse options highlighted

Expand and collapse the response preview by selecting the expand arrow in the response preview window.

Screenshot of the response pane with the expand and collapse options highlighted

Conveniently access the Microsoft 365 Developer Program site from the Graph Explorer UI to get a free sandbox with sample data to experiment with. Under the setting gear, select Get a sandbox with sample data.

Screenshot of Graph Explorer with the Get a sandbox with sample data option highlighted

Next steps