- Technical
- SharePoint
SHAREPOINT REST API
Mohanaruban Rajaguru
SharePoint is a tool to connect people and information. It provides a central site for sharing information with other users. SharePoint is web-based and accessible from anywhere in the world via an internet connection.
SharePoint provides places to store and share ideas, information, communication and documents. The sites facilitate team participation. The document libraries allow for easy checking in and checking out of documents and version control.
REST REpresentation State Transfer.
API Application Programming Interface.
SharePoint can beintegratedusing REST API, CAML Query and SOAP. With the help of its rich pre-defined REST API, we can develop application in any platform to utilize SharePoint features.
ExampletoGet a data:
$. ajax [{ url: URL, //THE ENDPOINT method: "GET", headers: {Accept": "application/JSON; odata=verbose}, success: function [data] { console.log [data.d. email] //RESULTS HERE!! } }];OData query operators supported in the SharePoint REST service
ExampleAPI://server/site/_api/web/lists[guid]/items?$select=Title,Products/Name&$expand=Products/Name
Below, Ihave listedsome Rest API list and it provides the details as tohow to get the values from the API. This is much helpful for beginners.
Site Information API:
Endpoint url://server/site/_api/Web/SiteUserInfoList
Users Information API:
- To get Current User Informationby using this API
Endpoint url://server/site/_api/Web/ currentUser
- To get all site users information by using this API
Endpoint url://server/site/_api/Web/siteusers
- To get particular group site users informationby using this API
Endpoint url://server/site/_api/Web/sitegroups[GroupId]/users
- Toget particular group site users informationby using this API
Endpoint url://server/site/_api/Web/sitegroups[GroupId]/users/getbyid[UserId]
Group Information API:
- Togetall group information:
Endpoint url://server/site/_api/Web/sitegroups
- Togetgroup information by using groupID:
Endpoint url://server/site/_api/Web/sitegroups/GetById[GroupId]
- Toget a user group:
Endpoint url://server/site/_api/Web/ GetUserById[+UserID+]/Groups
Endpoint url://server/site/_api/Web/ currentuser/? $expand=groups
LISTS Information API:
- Toget all properties from the list:
Endpoint url://server/site/_api/web/lists
- Toget a particular property of the list:
Endpoint url://server/site/_api/web/lists/getbytitle[Title]
- Toget the selected fields list:
Endpoint url://server/site/_api/web/lists/getbytitle[Title]/Items?select=ID,Title
- Toget the selected fields list by using filter:
Endpoint url://server/site/_api/web/lists/getbytitle[Title]/Items?select=ID,Title&$filter=[[IDeq 1] and [Title nezzz]]
- Toget the selected fields list by using Expand:
Endpointurl://server/site/_api/web/lists/getbytitle[Title]/Items?select=*,list2/Title,list3/Title&$filter=[[IDeq 1] and [Title nezzz]]&$expand=list2, list3
Postman Chrome REST Application
We can utilize Google Chromes application Postman to test the REST API calls before using it in our application. This application features output formats in JSON or XML which can be printed automatically.
Pass the Accept Header as application/JSON; odata=verbose to initiate the API calls. Also, you need to use interceptor to get the login cookies from the browser directly.Aftersending the API request, one may get
Result as:
{ "d": { "results": [ { [Array values] } } }Mohanaruban Rajaguru
About MST
At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.
Recent Articles
Implement Cascading Dropdown in SharePoint list
In this article, we will see how to implement a cascading dropdown in the SharePoint list using SP services.
Angular Service for Accessing SharePoint Lists Using REST API
SharePoint Lists can be accessed using REST API. Following is an AngularJS service that helps to create a list item, get items that are already created, update or delete an item from the list using functions that automatically build REST API query.
Work with us.
Our people arent just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.