Microsoft graph is a collection of APIs available in office 365. The idea is to have a single common way for accessing communicating with all the office 365 data. At this moment sharepoint rest APIs are superior in accessing the sharepoint data, which may change in future.
Graph explorer is an online web tool which can analyze what data is available and its responses. The graph explorer can be accessed from the URL https://graph.microsoft.io/
Once visiting the link select on the , select the "Graph Explorer" from the top navigation bar to get a screen like below.
It is showing a sample query with the URL https://graph.microsoft.com/v1.0/me/ which will return the data about the current user on clicking the "Run Query" button, since I have not used my credentials it will show a sample data. The URL text box will show a good number Graph APIs available.
Once I sign in with my credentials by clicking on the left side button "Sign in with Microsoft", I will be able to see my real time data, I was prompted to login with my microsoft account which will have access to the tenant.( It would be advisable to use a non global admin account, even though the graph explorer is from MS). It will ask to accept the permissions needed by the Graph Explorer.
To fetch information about my site collection I ran the below API query,
syntax: https://graph.microsoft.com/v1.0/sites/{hostname}:/{sitecollection relativepath}
For example if my hostname was mytenant.sharepoint.com and site collection url was mytenant.sharepoint.com/sites/xyz then my query needs to be as below
https://graph.microsoft.com/v1.0/sites/mytenant.sharepoint.com:/sites/xyz The output to my query is as follows.
More queries for sharepoint and other office 365 components are available in the following msdn link
No comments:
Post a Comment