A First Look At The New Microsoft Graph Explorer - Part One

Recently, Microsoft has launched the new and updated version of Microsoft Graph Explorer. The concept behind the Microsoft Graph API and the Microsoft Graph Explorer remain the same, but this launch is an effort by the Microsoft Graph team to make developer experience more engaging and to add more functionality to Microsoft Graph Explorer.

I have already written an article on the previous version of Microsoft Graph Explorer here while it was in effect. But with the launch of a new version with new UI, things have changed in Microsoft Graph Explorer. So, I wanted to write an article on it which will guide you through the new version. This article is part 1 of the multipart series I plan to write on the new Microsoft Graph Explorer.

Please note that this article is written in a way that it can be read as an independent article without the need to look at my earlier article.

Remember, there is no way to access the old version of Microsoft Graph Explorer. It has been totally replaced by the current version. My first impression is that you are going to like it much more than the old version.

Before we start with what’s new in Microsoft Graph Explorer, let’s first get a quick introduction of Microsoft Graph.

Microsoft Graph

The official Microsoft documentation defines Microsoft Graph as,

“Microsoft Graph exposes multiple APIs from Office 365 and other Microsoft cloud services through a single endpoint: https://graph.microsoft.com. Microsoft Graph simplifies queries that would otherwise be more complex.”

So, in a nutshell, Microsoft Graph gives you a single REST API endpoint which you can call to interact with “almost anything” in Office365. It delegates calls to different Office 365 cloud services via one single endpoint.

Now, let’s learn about Microsoft Graph Explorer.

Microsoft Graph Explorer

Microsoft Graph Explorer is a fantastic tool if you want to work with Microsoft Graph APIs or if you are learning to develop with Graph APIs. Consider it as a developer sandbox or a playground where a developer can have first-hand experience of Microsoft Graph APIs.

Where can you access Microsoft Graph Explorer?

It can be accessed here - https://developer.microsoft.com/en-us/graph/graph-explorer

Microsoft Graph Explorer

What do you need in order to work with Microsoft Graph Explorer?

Microsoft Graph Explorer provides you default login – a sample account with which you can fire some GET calls using Microsoft Graph APIs.

But if you want to explore more and also want to fire POST, PATCH and DELETE calls to Microsoft Graph API, then you will need to login with Microsoft credentials. I will suggest you get an Office 365 developer account.

Warning

A word of caution here; never play with your live Office 365 data or work account here with Microsoft Graph APIs. You may accidently update or delete some important information. It is advisable to use a test/demo account.

If you join the Microsoft Office 365 developer program here, Microsoft will give you one year free Office 365 developer subscription for non-commercial use with 5 users. You can read more on it in my related article “Office 365 developer program” here.

What can you do with Microsoft Graph Explorer?

A lot!

Microsoft Graph Explorer gives you a test client to access whatever you can access with Microsoft Graph REST APIs.

Using Microsoft Graph Explorer, you can:

  • Access/Modify data from Office 365 and other cloud services like SharePoint online, OneDrive, etc.
  • Navigate different Office 365 entities and traverse the relationships amongst them
  • Get intelligence and insights from the Microsoft cloud (limited to commercial users only)

In short, with Microsoft Graph Explorer is a one stop shop for everything you want to play with in Graph APIs.

Why should you use Microsoft Graph Explorer?

Microsoft Graph Explorer is a great tool to test how Microsoft Graph APIs work. A developer can use Microsoft Graph Explorer to:

  • Test Graph API calling logic beforehand dealing with any endpoint
  • See what data Graph API gives you back
  • See how the POST, PATCH and DELETE calls work
  • See how an entity in Office 365 can be accessed, using which relationship path

A first look at the new Microsoft Graph Explorer

Microsoft Graph Explorer

The screen shot of the new Microsoft Graph Explorer with some annotations above is mostly self-explanatory.

Some sections are covered in more detail below. I will also cover sections on left side in black background which were not mentioned in above screen shot due to space crunch:

The “Authentication” section

Microsoft Graph Explorer

By default, it launches API calls with the in-built sample account which you can use it to get some data without login in. You can sign-in to your account using the sign in button,

Microsoft Graph Explorer

Please note one thing here. If you go to the “Request Type” drop-down, you will see,

Microsoft Graph Explorer

You are not allowed to change the request type if you are not logged in with your Microsoft account. This is because someone can fire update/delete calls to Microsoft Graph API and change the data in Microsoft sample account. So, for the sanity anything except a “GET” is disabled till your login.

Once your login with your Microsoft credentials is done, then you can fire more queries apart from “GET” request type.

There is one more use of this sample account I have found. It has bulk data for messages and other items. Your newly created Office 365 developer account may not have that much data until you do the laborious task of creating it into your account. So when you want to test paging, delta queries, etc. this sample account comes into help.

The “Sample Queries” section

Microsoft Graph Explorer

In the left side section, just below authentication you will see the “Sample Queries” section,

Microsoft Graph Explorer

Here you will find some frequently used API calls labelled under “Getting Started”.

The purpose of the sample queries section is to provide developers a readymade API call which can be immediately executed in the Microsoft Graph Explorer without the need for the developer to go and find the API URL and input parameters in documentation.

You can directly click on any link in the “Sample Queries” section and that call will be fired immediately against the Graph API and result will be shown to you.

For example, let’s click on “my photo” link in the Sample Queries” section, you will see on the right-side section, the API call for getting user’s photo is executed and you are shown the result:

Microsoft Graph Explorer

The Graph Explorer automatically changes the API endpoint to https://graph.microsoft.com/v1.0/me/photo/$value, fires the query and shows you user’s photo.

Note the 3 different columns in the “Sample Queries” section for each row

  • Request Type
  • Brief name of API call
  • Link to documentation
Microsoft Graph Explorer

The first column
indicates the type of API call, which is “GET” here.

The second column indicates a brief name for the API call.

e.g. if you move the cursor over the “my profile” text you will see the tooltip,

Microsoft Graph Explorer

The tooltip/hint here indicates the actual API endpoint “https://graph.microsoft.com/v1.0/me“ which will be used in the call and which will be seen later in the API address bar once the call is fired,

Microsoft Graph Explorer

The third column is the link to the relevant Graph API documentation section. If you move mouse over to it, you will see tooltip for documentation,

Microsoft Graph Explorer

If you click on that link, the documentation will load in the new tab,

Microsoft Graph Explorer

Do you want to see some more sample queries?

Click on the “show more samples” link at the bottom of “Sample Queries” section,

Microsoft Graph Explorer

Microsoft Graph Explorer

A “Sample Categories” popup will open with some category/group names and options for each to make the selection ON or OFF,

Microsoft Graph Explorer

Notice that you were already seeing the “Getting Started” section, and here the section’s selection is “On”,

Microsoft Graph Explorer

The (6) at the end of “Getting Started” indicates there are 6 queries/endpoints in this section. This can be verified if you close the popup and once again go back to “Sample Queries” section,

Microsoft Graph Explorer

Now back to the “Sample Categories” popup. Let’s now select some more categories and see what happens. I have selected three more categories – Users, Outlook mail and OneDrive,

Microsoft Graph Explorer

Click on the “X” button on top right section to close the popup. See the “Sample Categories” section, you will have the selected categories in it,

Microsoft Graph Explorer

You can click on any call to get it fired and see result in Microsoft Graph Explorer.

Notice one thing here that if you are not yet logged in and using the sample account, then you cannot fire the “POST” calls,

Microsoft Graph Explorer

Once again click the “show more samples” link, and make all categories selection “off” and close the popup,

Microsoft Graph Explorer

You will see now there are no more  sample queries,

Microsoft Graph Explorer

This flow is just to show you how you can make category selection “on” or “off”. I will suggest you to check all the categories and all its queries once at least.

That’s it for part 1. I will cover more in part 2 of this series.

See you in the next article. Until then – Happy Learning!