Microsoft Graph API and Graph Explorer

Yohan Malshika
4 min readJul 5, 2020

Hi all, Hope you all are doing well. I thought about using my weekend for useful things. So I started my internship at 99X few weeks ago. Now i am working with a project and i had a task with Microsoft graph API. I had never worked with the Microsoft graph API before it. So I thought about writing about beauty of Microsoft graph API and trying to share some experience about it.

Microsoft Graph API and Graph Explorer

In this article, I will tell you,

  • What is Microsoft Graph API
  • What is Azure Active Directory (Azure AD)
  • Why Microsoft Graph API
  • Graph Explorer

Let’s start

What is Microsoft Graph API?

Microsoft graph API is a developer’s API platform that built on top of Microsoft 365 (previously called Office 365) and allows developers to integrate their services with Azure AD, Excel, Intune, Outlook, One Drive, One Note, SharePoint, Planner and Microsoft graph give us a single REST API endpoint to interact with Microsoft 365 (previously called Office 365) products https://graph.microsoft.com. We can use the Microsoft Graph API to interact with the data of millions of users present in Microsoft Cloud. All we need to do is register our application with Azure AD and then request Microsoft Graph API for accessing authentication tokens for the user.

What is Azure Active Directory (Azure AD)?

Azure AD is a cloud-based directory of users, groups and devices and an authentication service that is used by Microsoft 365. It authenticates users to the Microsoft 365 services, Exchange, SharePoint, OneDrive, Teams and so on.

Also Azure AD is core to Microsoft 365, it can be used to authenticate users to third-party cloud applications and websites, applications hosted by partners and applications that your organization is hosting.

So when we use Microsoft graph API, we have to register our application with Azure AD and then request Microsoft Graph API for accessing authentication tokens we need for graph operations.

Why Microsoft Graph API?

  • Simplify the user on-boarding that include assigning a role to users, provide permissions to documents, and assign product licenses, change users role and much more.
  • Scan your outlook Calendar & look at your next meeting. You also get recommendations on meeting times by scanning your calendar that contains attendees and their preferred time slots.
  • It supports file format conversion to PDF whereas other file types like Excel, Word, PowerPoint, CSV, and RTF can also be converted.
  • Respond to changes in Microsoft Graph data in real time. Notify others, when you reschedule a meeting & modify the file.

Okay, now we know about the Microsoft graph API and a few things that we can achieve by using the Graph API.

Graph Explorer

There is a small playground called Graph Explorer to play with Microsoft Graph API. We can use supported APIs on Graph API and then can get an idea about it’s usage.

Let’s start — Graph Explorer

Microsoft Graph Explorer

Now you can see, there is a Sign in with Microsoft button on the left side of the explorer. So first we have to authenticate using a Microsoft account to access the Graph API. Then after authentication, You can see Graph Explorer like this.

Microsoft Graph Explorer — After Authenticate

You can see a sample queries section in the left side of the explorer. So now you can click one query and see how it works.

For example, I just clicked My profile in sample queries.

https://graph.microsoft.com/v1.0/me/

Then you can see the successful response with JSON format. Also if you look at the top part of the screen,then you can see the endpoint.

I think you all got an idea about beauty of Microsoft graph API and how to use Graph API inside your application.

Good Luck && Happy Coding !!!

--

--