Graph API to retrieve user details

Eugenie Meng 146 Reputation points
2021-08-24T05:18:09.697+00:00

Hi,

I have a question on how to retrieve user details by calling the Microsoft Graph API: https://graph.microsoft.com/v1.0/users

No one in my organisation has used Graph API, and I need to retrieve User data by calling Graph API, when I tested the URI (https://graph.microsoft.com/v1.0/users) on browser, it gives me the following error message:

{"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2021-08-24T04:31:44","request-id":"xxxxxf-bxbx-4be2-axx5-xxxx","client-request-id":"474xx5f-b8bf-4xx2-axxx-xxxe"}}}

This sounds really silly but my experience with API is only limited to Get request, by testing the URI on a web browser, or using curl command, and use SSIS, and load data to SQL Server using SSIS Zappysys JSON Source . And the only authentication method I am familiar with is Basic Auth(username and password). Apart from this I don't have any development experience with API. I have global reader access to M365 admin portal and I am able to view and export all user data, I believe I have the right amount of permission to read data.

I went through MS Graph documentation (https://learn.microsoft.com/en-us/graph/auth/auth-concepts). Looks like an access token is required (also indicated in the error message). But to get the access token, the app needs to get registered on Azure portal. - This is the part I am confused, I am not sure what app it is referring to. My intention is to test the URI either on a web browser or curl command, and then use SSIS ZAPPYSYS JSON source to call the API, retrieve user data and load it to SQL Server DB (This was my approach to extract Jira data and it worked...).

Much appreciated if anyone can guide me on the next step on how to test call Graph API correctly.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,836 questions
0 comments No comments
{count} votes

Accepted answer
  1. JosephXu-MSFT 531 Reputation points
    2021-08-24T08:06:36.35+00:00

    Hi @Eugenie Meng To use Microsoft Graph to read and write resources on behalf of a user, your app must get an access token from the Microsoft identity platform and attach the token to requests that it sends to Microsoft Graph. Please refer this documentation.

    1. The easiest way is we can use graph explorer to access Microsoft Graph APIs.
    2. We also can use Postman to access Microsoft Graph APIs.

    ----
    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful