Microsoft SharePoint is a web-based collaborative platform that allows the creation of powerful websites. SharePoint is not installed on your computer locally but instead connected from a browser, and it is primarily used as a document management and storage system.
Microsoft SharePoint is more than just an application installed on your computer. SharePoint’s most valuable features are collaboration and sharing, which help you stay organized by creating workflows and automating tasks. It is also the right place for you to store your documents securely.
This article discusses SharePoint API, Sharepoint REST API to be specific, that you can leverage for your team to work well together. You’ll also learn to work around SharePoint REST API HTTP commands for added functionality.
What is the SharePoint REST API?
Representational State Transfer, also known as REST, is a standardized Software Architecture Style, or, in other words, a specific type of API used by the industry to establish a connection between Client and Server. REST API is built to guide the development and design of the World Wide Web’s architecture.
REST API provides a flexible, lightweight way of interacting with SharePoint remotely using any technology supporting the REST protocol. With SharePoint API, you can easily perform basic Create, Read, Update, and Delete (also known as CRUD) operations. This can be done from SharePoint Add-ins, Solutions, and Client Object Model Applications. The REST interface exposes all the SharePoint entities and operations available in other SharePoint APIs.
Introduced by Microsoft in SharePoint 2013, the REST service is similar to existing SharePoint Client Object Models like JSOM and CSOM.
Hevo’s REST API integrations enable seamless data extraction and synchronization, ensuring your data is always up-to-date. This integration enhances data accessibility and streamlines workflows, allowing for more efficient and informed decision-making. Key Benefits:
- Code-Free Integration: Effortlessly connect REST APIs to your data warehouse without any coding.
- Real-Time Data Sync: Keep your data up-to-date with continuous, real-time syncing.
- Analysis-Ready Data: Data is transformed and structured for immediate analysis, saving valuable prep time.
Try Hevo and experience the seamless integration.
Get Started with Hevo for Free
Advantages of Using SharePoint API
- SharePoint API is easier to work with and can be accessed from the browser to test the results.
- SharePoint REST API allows you to interact with SharePoint Sites remotely using any technology supporting REST protocol.
- One of the main advantages of using SharePoint REST API is that you can directly retrieve or update SharePoint entities (such as Webs, Lists, and List Items) by creating and sending HTTP requests to appropriate endpoints (URL) without adding references to any SharePoint Libraries or Client Assemblies.
- With SharePoint REST API, no SP.js files must be uploaded for code execution.
How Does SharePoint REST API Work?
Before working around SharePoint REST API, you must construct a RESTful HTTP request using the Open Data Protocol (OData) standard. Open Data Protocol (OData) is used along with REST to access many Cloud-based services. The HTTP request corresponds to the desired Client Object Model API.
Your Client Application will then send an HTTP request to the client.svc web service internally calls the Server Object Model to retrieve data from the Content Database. The Client Application parses the response sent in either Atom or JSON (JavaScript Object Notation) format.
Types of Sharepoint API
SharePoint provides a robust set of APIs that allow developers to interact with SharePoint sites, lists, documents, and other components. Here are the main types of SharePoint APIs and their differences:
1. REST API
The SharePoint REST API allows developers to interact with SharePoint data over HTTP. It provides a simple and flexible way to interact with SharePoint resources, including lists, libraries, and sites, and supports JSON data formats.
Key Features
- Accessible via
HTTP requests (GET, POST, PUT, DELETE)
- Supports querying data, creating and updating items
- JSON-based responses
Example
GET /_api/web/lists/getbytitle('Documents')/items
2. CSOM (Client-Side Object Model)
CSOM allows developers to interact with SharePoint from client-side applications (e.g., web, desktop, or mobile apps). CSOM is used for .NET applications and supports a rich object model for working with SharePoint lists, libraries, and other resources.
Key Features
- Allows interaction with SharePoint from client applications
- .NET-based (can be used in C#)
- Supports operations like CRUD (Create, Read, Update, Delete)
- Asynchronous processing
Example (C#)
ClientContext context = new ClientContext("https://yoursharepointsite");
List list = context.Web.Lists.GetByTitle("Documents");
CamlQuery query = new CamlQuery();
ListItemCollection items = list.GetItems(query);
context.Load(items)
context.ExecuteQuery();
3. JSOM (JavaScript Object Model)
JSOM is a client-side API for interacting with SharePoint using JavaScript. It is mainly used in SharePoint add-ins (apps) or custom web parts that run in the browser. Like CSOM, JSOM provides a rich object model for SharePoint data manipulation.
Key Features
- JavaScript-based (ideal for SharePoint add-ins)
- Suitable for working in browser-based environments
- Supports CRUD operations and more
Example (JavaScript)
var context = SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Documents');
var items = list.getItems(SP.CamlQuery.createAllItemsQuery());
context.load(items);
context.executeQueryAsync(function() {
console.log('Items fetched');
}, function(sender, args) {
console.log('Error: ' + args.get_message());
});
4. SOAP Web Services
SOAP (Simple Object Access Protocol) Web Services were traditionally used to interact with SharePoint, though they are now deprecated in favor of REST and CSOM. SOAP is a protocol for exchanging structured information in the implementation of web services.
Key Features
- XML-based communication
- Supports legacy systems
- More complex than REST for most tasks
Example (SOAP Call)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://schemas.microsoft.com/sharepoint/soap/">
<soapenv:Header/>
<soapenv:Body>
<web:GetListItems>
<web:listName>Documents</web:listName>
</web:GetListItems>
</soapenv:Body>
</soapenv:Envelope>
5. Microsoft Graph API
Microsoft Graph API is a unified API endpoint that provides access to a variety of Microsoft services, including SharePoint, OneDrive, Outlook, and more. It is the recommended API for modern SharePoint development.
Key Features
- Unified API for various Microsoft services
- Access SharePoint data through sites and drives endpoints
- Supports modern authentication methods like OAuth
- Offers broader functionality beyond SharePoint
Example
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
6. SharePoint Online Management Shell (PowerShell)
PowerShell provides an automation script-based interface to interact with SharePoint Online. It is used for administrative tasks, such as managing sites, users, and documents.
Key Features
- Command-line based
- Ideal for administration and automation
- Works with SharePoint Online (Office 365)
Example
Connect-SPOService -Url https://yoursharepointsite-admin.sharepoint.com
Get-SPOSite
API Type | Technology | Technology | Response Format | Platform |
REST API | HTTP/JSON | Access SharePoint data via HTTP requests | JSON | Web/Client Apps |
CSOM | .NET (C#) | Client-side SharePoint operations in .NET apps | Objects (XML/JSON) | .NET-based apps |
JSOM | Javascript | Client-side SharePoint operations in browser | Objects (JSON) | SharePoint Add-ins |
SOAP Web Services | XML | Legacy method for accessing SharePoint data | XML | Legacy systems |
Microsoft Graph API | REST (OAuth) | Unified API for SharePoint and other Microsoft services | JSON | Web, Office 365 Apps |
Load Data from REST API to any Data Warehouse
No credit card required
Understanding SharePoint REST API Commands
With SharePoint API, by building REST endpoints, you can perform typical CRUD (Create, Read, Update, and Delete) operations against SharePoint entities, such as Lists and Sites. The REST endpoints in the SharePoint API correspond to the types and members in the SharePoint Client Object Models.
Endpoints representing Read operations (such as reading data from the SharePoint site) are mapped to HTTP GET
commands, Create operations (such as creating a List or Library) are mapped to HTTP POST
commands and Update or Insert operations (such as updating a List or Library Title or Description) are mapped to HTTP PUT
commands. To start with SharePoint REST API Example, you must create an HTTP request
to build endpoints.
GET
In SharePoint API, the HTTP GET
command reads or retrieves information from the SharePoint site. Typically, endpoints representing any Read operation use the GET method.
POST
In SharePoint API, the HTTP POST
command creates or updates a List or Library in a SharePoint Site. In SharePoint API POST endpoints, optional properties are set to default values.
PUT/MERGE
In SharePoint API, the HTTP PUT
and HTTP MERGE
commands update an existing entity in a SharePoint List/Library or SharePoint List/Library Title/Description.
Setting properties is optional in the SharePoint REST API HTTP MERGE
method, and if any property is not set explicitly, it keeps its current property. However, it is mandatory to set up all the required properties while updating SharePoint objects in the HTTP PUT
method. Optional properties are set to their default values if not set explicitly.
DELETE
In SharePoint API, the HTTP DELETE
command is used to delete any SharePoint object like deleting a SharePoint List, SharePoint Library, Documents, etc.
Now that you have a basic idea of various HTTP commands
let’s implement them to perform CRUD operations.
SharePoint REST Endpoint Examples
First, to start with SharePoint REST API, you must create a REST endpoint. All the REST endpoint URLs start with:
https://SiteURL/Sites/SiteName/_api/
Here are various examples of SharePoint REST API endpoints.
Operation | SharePoint Rest API endpoint |
Retrieve SharePoint Site Collection | https:///{site url}/_api/site |
Retrieve a particular SharePoint Site or Web | https:///{site url}/_api/web |
Retrieve SharePoint Site Title | https://{site url}/_api/web/title |
Retrieve all SharePoint Lists | https:///{site url}/_api/web/lists |
Retrieve all the Items from a SharePoint List | https:///{site url}/_api/web/lists/getbytitle(‘listname’)/items |
Retrieve SharePoint List Title | https:///{site url}/_api/web/lists/getbytitle(‘listname’)?select=Title |
Retrieve all the columns of a SharePoint List | https:///{site url}/_api/web/lists/getbytitle(‘listname’)/Fields |
Retrieve a SharePoint List by using List GUID | https:///{site url}/_api/Web/Lists(List GUID) |
Retrieve a SharePoint List Item by Item Id | https:///{site url}/_api/web/lists/GetByTitle(‘listname’)/GetItemById(2) |
Retrieve SharePoint Current User Information | https:///{site url}/_api/Web/currentUser |
Retrieve selected Fields of a SharePoint List Items | https:///{site url}/_api/web/lists/getbytitle(‘listname’)/Items?select=ID,Title,FirstName,LastName |
Retrieve all SharePoint Site Users
| https:///{site url}/_api/Web/siteusers |
Retrieve all Groups from a SharePoint Site | https:///{site url}/_api/Web/sitegroups |
Retrieve a particular SharePoint Group by Group Id | https:///{site url}/_api/Web/sitegroups/GetById(GroupId) |
Retrieve all the Users from a SharePoint Group | https:///{site url}/_api/Web/sitegroups(Id)/users |
Sync Data from REST API to BigQuery
Sync Data from REST API to Snowflake
Sync Data from Microsoft Advertising to Redshift
Conclusion
As you already know, SharePoint has recently been one of the best collaborative platforms for organizations. Organizations have started leveraging SharePoint API to perform various operations to unleash its full potential. This article introduced you to SharePoint API and showed you how to implement SharePoint REST API endpoints to perform basic operations.
Extracting complex data from a diverse set of data sources like SharePoint can be challenging, and this is where Hevo saves the day! Hevo’s native REST API connector allows you to not only export data from sources & load data in the destinations but also transform & enrich your data.
Want to take Hevo for a spin? Sign Up for Hevo’s 14-day free trial and experience the feature-rich Hevo suite first hand.
FAQ on SharePoint REST Services
What is a SharePoint API?
The SharePoint API (Application Programming Interface) is a set of protocols and tools that allows developers to interact programmatically with SharePoint sites and data.
Can SharePoint connect to API?
Yes, Sharepoint can connect to various APIs.
How do I call REST API from SharePoint?
To call a REST API from SharePoint you can use JavaScript or TypeScript, make HTTP requests to the external REST API endpoint. You also need to handle authentication, headers and request parameters.
What is the difference between SharePoint and OneDrive?
SharePoint is designed for team collaboration, content management, and building intranet sites within organizations, whereas OneDrive is focused on individual file storage and personal productivity.
Raj, a data analyst with a knack for storytelling, empowers businesses with actionable insights. His experience, from Research Analyst at Hevo to Senior Executive at Disney+ Hotstar, translates complex marketing data into strategies that drive growth. Raj's Master's degree in Design Engineering fuels his problem-solving approach to data analysis.