While
developing solutions for office 365 Microsoft graph API will help you in
achieving the required output.
In my
previous project where I have used Graph API, I found it difficult for getting
info on some of the endpoints. Below I will try to list out some of the basic
and most used end points of Microsoft graph API for SharePoint.
Getting site level information
Searching
for Sites
it returns
the list of site collections the user have permission.
Site details based on the relative path
Host-name:-
contoso.sharepoint.com
Server
relative path:- sites/test1
Different ways to get list data
Get the
list data for a root site
Get the list data for a relative site collection
for example
if you want to fetch the details of the list with the name list1
Getting all the fields of a SPList item
For getting
all the fields of a list item we need to use the expand query parameter.
For a root
site collection
https://graph.microsoft.com/v1.0/sites/root/lists('list1')/items?expand=fields(select=field1,field2)
For a site collection with a relative url
https://graph.microsoft.com/v1.0/sites/<hostname>:<server-relative-path>:/lists(‘<list name>’)
/items?expand=fields(select=field1,field2)
Batch Requests in Graph API
Using the
Batch request we can combine multiple requests for graph api as single request. Each
request is tracked with an ID and response will be returned with the same ID. Batch
request can be a combination of both get and Post requests.
Method:
Post
Graph API Url:
https://graph.microsoft.com/v1.0/$batch
Comments
Post a Comment