Forum Discussion
SharePoint online REST API access from postman
To get a token from your application, without user interaction, you should use the client credentials flow. Here's the https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow from Microsoft. Since you're using Postman, notice that they provide a great collection of REST calls to get the token that you need. But before that, you should use Azure to create an app registration and set up the permissions you need. The article you mentioned uses an old and non-recommended way to authenticate to SharePoint.
Now, to connect directly to your SharePoint site and make your CRUD requests, I would recommend you use the https://pnp.github.io/pnpcore/index.html, a great library for .NET that simplifies the authentication and the requests for you.
The problem using the client credentials flow is that, to connect to SharePoint, you need to generate and upload a certificate, which could be a pain in the butt. If you follow through the process to generate and upload a certificate to Azure, then you can use the PnP Core SDK to talk to SharePoint.
However, the easiest way to talk to SharePoint, without having to create and upload a certificate, would be to get a token to MS Graph, and use the /sites endpoint to talk to your SharePoint site. From there, you can make CRUD requests to your list as well, once you find the endpoint to it. The upside of this approach is that you only need a client id and a client secret to get a token from MS Graph, so you'd be able to test the requests through Postman.
Let me know if you need help following any of these approaches.
I actually already have a registered Azure App that I'm using to interact with some other Microsoft APIs but I was not aware that I could use Graph to interact with SharePoint, that's great news! Basically what the integration needs to do is to eventually create a document library in a given SharePoint site and add documents to that document library, all using HTTP requests of course ... I'll give it a try using the MS Graph approach, it would for sure be my preferable choice.
Thanks a lot for your help and guidance
Vicente