curl request to Microsoft Sharepoint API?

KJ50 picture KJ50 · Feb 11, 2015 · Viewed 10.3k times · Source

Is there a simple way to use a cURL request to the REST API to access a file on my Sharepoint account? For example

curl -i -H "Authorization: Bearer <some-key-here>" https://mysharepoint.com/_api/web/Lists

I have read all the documentation about authentication and authorization for apps, but in this case I don't have an "application" that I can register. I simply need an API key of some kind to use in REST requests. How can I use the REST API in this way?

I appreciate any insight into this problem.

Answer

LOLWTFasdasd asdad picture LOLWTFasdasd asdad · Aug 23, 2017

If this is still relevant, this did it for me:

curl https://mysharepoint.com/_api/web/Lists -v --ntlm --negotiate -u user:password

You basically authenticate using ntlm (Note that some sharepoints might require Kerberos) and then can easily access the REST API like you can via browser.


Edit does not work with Office 365 apparently.