Microsoft Graph API integration from Pega V8.x

Brief idea on MS Graph API:

Microsoft Graph is a Microsoft developer platform that connects multiple services and devices. Initially released in 2015, the Microsoft Graph builds on Microsoft 365 APIs and allows developers to integrate their services with Microsoft products, including Windows, Microsoft 365, and Azure. The Microsoft Graph API offers a single endpoint, https://graph.microsoft.com, to provide access to rich, people-centric data and insights exposed as resources of Microsoft 365 services. Microsoft Graph exposes REST APIs and client libraries to access data on most of the Microsoft cloud services. 

The below diagram gives a high level idea.











The Microsoft Graph explorer is a tool that lets you make requests and see responses against the Microsoft Graph. To access this tool, we need to have access in Microsoft Azure Portal. I have free trial access with limited features from Azure. Here is the portal URL to get the access: https://portal.azure.com/ 

Here is the Graph Explorer tool and is same as our Postman/SOAP UI to test the connectivity. 













To access the Graph API from Pega or any other application, we need to generate the Access token using OAuth2. The main parameters to pass in Access token API: https://login.microsoftonline.com/{{TenantID}}/oauth2/v2.0/token are client_id,tenant_id,client_secret,etc. To get all these parameters, we need to login in Azure and use them. Access token is the key to access any other API's and is valid for an hour. 

To use this token API in Pega, we can create a REST Connector and import it from the connector wizard. We need to make sure to store/cache this token data in a DataPage.

Below snapshot gives an idea on capturing of these parameters.
















Based on our requirement, we need to create as many as REST connectors by consuming the token data from the DataPage. For some of the API's, we have full access privileges but for some of them we need the admin access permissions. If Pega gives a component on this API then we don't worry about all the connectors design logic.

To explore more on all the useful API's, import all the below mentioned Postman links given by Microsoft team.

https://raw.githubusercontent.com/microsoftgraph/microsoftgraph-postman-collections/master/Microsoft%20Graph.postman_collection.json 

https://raw.githubusercontent.com/microsoftgraph/microsoftgraph-postman-collections/master/Microsoft%20Graph.postman_environment.json 

Here are the YouTube videos on how to consume these API's from Postman. I like these videos and followed them well to understand the API's functionality.

https://www.youtube.com/watch?v=7Sx2pFY21YQ

https://www.youtube.com/watch?v=4tg-OBdv_8o

Bottomline is like MS Graph API works on one single endpoint with a single token for accessing multiple resources from the MS products easily.

References:

1) Google.com

2) https://docs.microsoft.com/

3) https://portal.azure.com/

4) https://developer.microsoft.com/en-us/graph/graph-explorer

Popular posts from this blog

Connecting Claude to Pega Infinity 25.1.3 via MCP — Step-by-Step

itextpdf API to generate PDF doc from an image file using Pega PE

Understanding of Hugging Face platform for AI/ML platform