I am using C# HttpClient to query odata from Sharepoint. This works wonderfully if I am accessing a list.
I generate the SharePointOnlineCredentials to get authentication cookie and then I pass the full URL to this method:
HttpResponseMessage response = client.GetAsync(fullUrl).Result;
For lists, I always get the proper response back as json that I then parse out. For Document Libraries, this doesn't work... everything I read indicates that it should, but I always get a 404 response.
My actual Sharepoint api url looks like this:
https://<site>/<subsite>/_api/web/lists/getbytitle('<listName>')/items
If I run that URL in a chrome browser, it works for both lists and document libraries, but when I run that same exact URL in the C# HttpClient, it only works for lists... for some reason I get 404 for document library...
On a somewhat related note, I get "Bad Request" errors if I attempt to use any ODATA filters on a list or document library... but again, the filters work great in the browser... just not the C# HttpClient code...
Does anyone have ideas for what I can try? I'm at my wits end...