I'm have created a survey in my company sharepoint online site. The response is collected in a list. I want to extract the data from this list by sending a CURL request from another server to REST API for further processing. The site URL goes like this: https://company.sharepoint.com/sites/ABCD. I can access the list using this endpoint in browser: https://company.sharepoint.com/sites/ABCD/_api/web/lists/GetByTitle(title)/items

While trying to access the API through CURL, I am getting an error saying unauthorizedAccessException. HTTP/1.1 403 Forbidden error.

<m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message>

Below is the curl request:

curl "https://company.sharepoint.com/sites/ABCD/_api/web/lists/GetByTitle(title)/items" -v --ntlm --negotiate -u domain\\email_address

Can someone please explain what is the issue with this request or is this the correct way to send API request. Some forums I read say that I may need to generate access_key using an APP ID. But I dont know how to do that.

Any help on this is deeply appreciated. I am a newbie to sharepoint.

curl -X GET --ntlm -u <email>:<password>  https://mycompany.sharepoint.com/<URL> 

This worked for me and trigger the page contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.