I've been working for a while with SharePoint 2010 via REST API in my Java project.
For example, to list items under some directory in my SharePoint storage, I was doing like this:
NTCredentials credentials = new NTCredentials(username, password, null, domain);
HttpClient httpClient = //preparing HttpClient and providing created credentials to it;
HttpGet getMethod = //preparing GET method with setting appropriate Accept header and builded URL;,
where URL
is built with appropriate API constants and filters, something like this:
http://mysharepointserver/_vti_bin/ListData.svc/SomeService?$select=Name,Modified,ContentType,Path&$filter=((Path%20eq%20'/SomePath'))
Now I'm trying to make Office 365 SharePoint work in the way similar to it, but I don't succeed yet. (Most likely because I didn't catch some basic moments about the way it should work).
I can login into my Office 365 SharePoint via https://login.microsoftonline.com
page.
When I try to make a request to my Office 365 SharePoint server in the same way as I do for a SharePoint 2010 server, I receive 403 Forbidden
error.
I also have some clientId
and redirect URL
after registering my application to the Azure AD, but I don't understand how to use it properly.
So, what am I doing wrong and how to make all this stuff work properly?