While learning graph API, I was trying to get a file from a SharePoint document library using Microsoft Graph API.
I first tried by accessing files in Documents
from https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com
by doing this GET request:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com/drive/root:/Test:/children
Everything worked great, I then tried accessing documents from another site within the same tenant. I told my self it was the same pathway while following the Microsoft docs.
I first did a test request to be sure i can first access to my site; here is what I did;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite
On executing that query i got a 200 OK
response.
Secondly I then tried accessing the drive Documents
here is what i did;
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive
again everything worked fine.
I then used the root
relation followed by the name of the directory and then the children
relation; and this was my request:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive/root:/Test:/children
But while executing that, I'm getting Bad Request - 400 - 96ms
Please help.
Thanks
"date": "2020-06-16T07:46:56"
"request-id": "271e1161-734a-4684-82f0-6eeb18f842b2"
The second alternative using [hostname,site-guid, web-guid] works great! – The_Thinker