SharePoint API and REST API: What are they for?
APIs are the means by which different systems communicate with one another, exchanging data and commands. SharePoint, the main collaboration platform in Microsoft 365, leverages different types of APIs to enable users to create, customize and maintain the web parts that make up sites such as the corporate intranet. Among these APIs, REST APIs play an important role due to their flexibility.
In this article, we will look in detail at what SharePoint APIs are and what they are used for, what distinguishes REST APIs, and what functionality is possible through integration with Microsoft Graph.
SharePoint APIs: What are they?
In programming, APIs represent the means by which a program is able to communicate with another program or an external data source. In the case of SharePoint, APIs enable the creation of the web parts of a site such as the intranet.
Developers then use APIs to connect SharePoint to specific data sources, from which they derive the information needed to provide content and functionality in the web parts that make up a site.
When information from a data source connected to SharePoint via API is updated, it is important to note that the content of the related web part updates automatically and in real time.
SharePoint APIs fall into four main categories:
- REST APIs, which allow access and manipulation of SharePoint resources with simple HTTP calls. In general, RESTful requests perform CRUD (Create, Read, Update, Delete) operations on items in SharePoint such as lists, documents, and sites.
- Client-Side Object Model (CSOM): the type of API that provides a set of libraries for use in languages such as JavaScript, .NET, and Silverlight to interact with SharePoint. These APIs are useful for performing client-side operations, since they involve executing code directly in the user's browser.
- JavaScript Object Model (JOM): a category of API similar to CSOM, but specific to JavaScript. It is therefore often used to create the dynamic interfaces of SharePoint web parts.
- SOAP Web Services: although less widely used than the others, these APIs make it possible to communicate with SharePoint through XML-based protocols.
SharePoint's set of APIs makes it possible to connect web parts to a wide range of data sources, including external databases (e.g., SQL Server), cloud services (such as Microsoft Azure), ERP/CRM systems (e.g., Dynamics 365 and Salesforce), and a host of other services and applications.
Taking the API connection with a SQL Server as an example, a web part could display the list of projects stored in the database. This integration allows authorized users to view the information they are interested in directly in the SharePoint intranet, without having to access separate systems or manually transfer data after an update.
This, then, is what SharePoint APIs are: the building blocks we need to build, customize and maintain all the web parts that enrich the functionality and content of any SharePoint site.
What is intranet.ai?
intranet.ai is the ready-to-use corporate intranet, designed to reduce costs and implementation times, thus creating a collaborative and modern digital work environment:
- Initial price of 3,650 €/year for a complete intranet
- 50+ applications, including advanced search, document management system, push notifications via Teams, personal profile, and FAQ pages
- 100% integrated with SharePoint Online and Microsoft 365
SharePoint REST APIs: What are they?
REST APIs, which stand for Representational State Transfer Application Programming Interfaces, are a set of architectural principles for designing and developing network systems.
The REST architecture focuses on the concept of resources. They are in fact based on a communication model where clients send requests to servers to perform actions on specific resources. These requests typically take the form of HTTP methods such as GET, POST, PUT, PATCH and DELETE, each of which corresponds to different operations on the resources.
In the specific case of SharePoint, the resources on which the REST API acts can be:
- The elements of a list
- The documents of a library
- A site, in its entirety
Clients can then send HTTP requests to perform actions on the resources, such as retrieving certain information or making changes. One example is sending a GET request to obtain the details of a document in a SharePoint library; a second example might be a POST request, often used to add items to a list.
This flexibility makes REST APIs a powerful tool for integrating and automating interactions with SharePoint, enabling developers to build applications that easily interface with the platform's data and functionality.
Other aspects that characterize SharePoint's REST APIs include:
- Ease of use, allowing them to work with structured and unstructured data efficiently.
- Security, as authentication is handled through OAuth and access tokens. This means that only authorized users and applications can interact with resources.
- Context independence, since REST requests can be made from any environment that supports HTTP calls, including browsers and mobile applications.
- Scalability, allowing a large number of simultaneous requests to be handled without overloading the server.
What is the difference between APIs and REST APIs in SharePoint?
As we have seen, APIs are sets of definitions and protocols that allow different software to communicate with each other. There are various types, including library APIs, operating system APIs, or Web service APIs, which can be designed using various architectural styles and protocols such as SOAP, GraphQL, and REST.
REST APIs, specifically, represent a type of API that follows the architectural principles of REST (Representational State Transfer). This style is characterized by a stateless communication model, where each client request to the server contains all the information necessary to perform the requested operation. REST APIs use HTTP methods (GET, POST, PUT, PATCH, DELETE) to perform operations on resources, identified by unique URLs.
So: while all REST APIs are APIs, not all APIs are REST APIs.
Even in the case of SharePoint, REST APIs are only one of many ways through which you can interact with external platforms and data sources. It is useful to use REST APIs to create SharePoint web parts when light and flexible communication with related data sources is needed.
In fact, REST APIs make it possible to build dynamic, interactive web parts capable of interfacing with a variety of internal and external data sources without compromising performance or code simplicity.
Other types of APIs may serve in different contexts. For example, SOAP APIs are better suited in the case of complex integrations that need more control over communication. Similarly, CSOM-type APIs are preferred by developers working with a client-side object model, providing a more natural development experience in applications.
What data sources can SharePoint connect to via APIs?
Through its API, SharePoint can connect to a wide range of data sources and programs to enrich its functionality and content on sites such as the intranet.
Just in the case of the intranet, web parts can leverage SharePoint's API to connect to the following data sources.
1. SharePoint lists and libraries
Web parts can then manage structured data such as announcements, contacts, events and activities. They also make it easy to view and edit content in SharePoint repositories, such as business documents or media files.
2. External databases
Web parts connect to SQL Server databases, allowing intranet users to directly access archived information without changing environments. In addition, APIs also allow web parts to connect to Database Management systems, such as Oracle, so as to provide a centralized view of corporate data.
3. Microsoft 365 applications
Information from the other products that make up the Microsoft 365 digital workplace (of which SharePoint is a part) can be integrated into SharePoint web parts via APIs. These products include:
- Outlook, to integrate e-mail, calendar and contacts.
- OneDrive, to simplify the management of personal and shared files.
- Teams, to integrate chat, channels and other collaboration features.
- Planner, to update project activities and coordinate team work.
4. Cloud services
SharePoint web parts can communicate with Microsoft Azure services, including Azure Blob Storage, Azure Functions and Azure SQL Database. In addition, they can report on Power BI reports and dashboards.
5. ERP/CRM
Web parts can obtain data found in systems such as Microsoft Dynamics 365 and Salesforce. Information about customers, sales, and support activities thus becomes searchable on the intranet, supporting users' work.
For example, the Sales team could view recent customer communications managed by the support team and gain insights useful for managing business negotiations. Similarly, the support team can access sales details to analyze customer problems and propose customized solutions.
6. Business Intelligence Tools
In addition to Power BI, SharePoint web parts can connect via API to Tableau and Qlik. These are some of the most popular and widely used tools in companies for data analysis, and integration with SharePoint allows for centralized access to information in the intranet and thus streamline decision-making processes.
7. Social media and other communication channels
Web parts can be integrated with the company's social profiles, for example those of LinkedIn or Twitter, to show in the intranet the latest posts published or highlight the most important content for the company. In addition to social media, content in RSS format (e.g., news from an online trade magazine) can also be imported into SharePoint.
At intranet.ai, we have built on this very use of the SharePoint API to create the "Social Media Posts" and "RSS Feed" web parts, with which our customers can easily enrich the content of the intranet we have built together.
SharePoint API and Microsoft Graph API:
is there a relationship?
Microsoft Graph is a developer platform that provides a unified gateway for accessing Microsoft 365 data and services, including Azure Active Directory, Outlook, OneDrive, Teams, Excel, Planner, and SharePoint.
It thus provides access to Microsoft's multiple services from a single entry point, greatly simplifying application development and management for developers. Graph also supports a wide range of operations, including:
- interaction with files and documents in OneDrive
- mail and calendar management in Outlook
- collaboration and communication in Microsoft Teams
- management of user identities in Azure Active Directory
Thus, there is a close relationship between Microsoft 365 product APIs and Microsoft Graph APIs, and SharePoint is no exception.
The integration of SharePoint APIs into the Microsoft Graph ecosystem allows developers to access SharePoint data and functionality via the same endpoints and authentication tokens used for other Microsoft 365 services. In practice, the Microsoft Graph APIs provide a uniform interface for interacting with SharePoint resources, making interoperability between SharePoint and other Microsoft 365 services easier.
With Microsoft Graph, it is possible, for example, to retrieve information on a SharePoint site, access documents stored in a library, or manage access permissions to corporate files. Easily, through HTTP calls.
The result is a robust, integrated platform that simplifies the development process, enabling companies to harness the full potential of their data and applications.
Do you want a complete, ready-to-use intranet?
"Intranet-in-a-box" is the complete service for your company:
- We offer you a branded intranet already integrated with Microsoft 365 and Viva.
- We go beyond the limits of a standard corporate site with our customizable features.
- We update all components to the latest Microsoft standards.
Simplify internal communication and digitize your business with minimal investment.
Giuseppe Marchi
Microsoft MVP for SharePoint and Microsoft 365 since 2010.
Giuseppe is the founder of intranet.ai and one of the leading experts in Italy in all matters related to Microsoft 365. For years, he has been assisting companies in creating their digital workplace environment on the Microsoft cloud, focusing on people's experience.
FAQ about SharePoint APIs and REST APIs
What are SharePoint APIs and what are they used for?
SharePoint APIs are sets of definitions and protocols that allow communication between SharePoint and other applications or external data sources. These APIs enable the creation, customization, and maintenance of web parts that make up sites like the corporate intranet, ensuring integration and automatic content updates.
What are SharePoint REST APIs and what are they used for?
SharePoint REST APIs are a set of architectural principles for designing and developing network systems. They allow access to and manipulation of SharePoint resources through simple HTTP calls, performing CRUD (Create, Read, Update, Delete) operations on elements like lists, documents, and sites.
What is the difference between APIs and REST APIs in SharePoint?
APIs are sets of definitions and protocols for communication between different software, while REST APIs represent a type of API that follows the architectural principles of REST (Representational State Transfer). REST APIs use HTTP methods to perform operations on resources, identified by unique URLs. Not all APIs are REST APIs, but all REST APIs are APIs.
What data sources can SharePoint connect to via APIs?
SharePoint can connect to a wide range of data sources via APIs, including SharePoint lists and libraries, external databases (such as SQL Server and Oracle), Microsoft 365 applications (Outlook, OneDrive, Teams, Planner), cloud services (Microsoft Azure, Power BI), ERP/CRM systems (Dynamics 365, Salesforce), business intelligence tools (Tableau, Qlik), and communication channels like social media and RSS feeds.
Is there a relationship between SharePoint APIs and Microsoft Graph APIs?
Yes, Microsoft Graph is a platform that offers a unified gateway to access data and services across Microsoft 365, including SharePoint. The integration of SharePoint APIs into Microsoft Graph allows developers to access SharePoint functionalities using the same endpoints and authentication tokens used for other Microsoft 365 services, simplifying interoperability between SharePoint and other Microsoft services.
Keep on reading
SharePoint: cos'è, a cosa serve e 7 funzionalità chiave
SharePoint is Microsoft 365's platform for document management and enterprise site creation. Let's see how it works.