I am trying to retrieve data from a SharePoint Online list using a REST API call, but I am encountering an issue. Here is the code and request structure I am using:
GET https://companyname.sharepoint.com/_api/web/getbytitle('listname') Authorization: "Bearer " + accessToken Accept: "application/json;odata=verbose"I keep getting an error when making the request. However, the bearer token seems to be correctly generated, as I can retrieve it without any issues.
I have set up permissions in Azure AD (Entra ID), and the application has the necessary API permissions.The token is generated via the Client Credentials flow.The request is sent using Postman (or another HTTP client/tool).
What could be causing this issue? Am I missing any specific permissions or headers required by SharePoint Online? Do I need to adjust the request format?
Any insights or guidance would be greatly appreciated!


