REST (SharePoint)
SharePoint Representational State Transfer (REST) service.
REST (Representational State Transfer) is an architectural style that allows you to interact with SharePoint data using standard HTTP requests. SharePoint provides a RESTful web service that enables developers to access and manipulate SharePoint resources such as lists, items, and libraries in a straightforward and flexible manner.
Key Features of SharePoint REST API
- Standard HTTP Methods: Supports standard HTTP methods like GET, POST, PUT, and DELETE to perform CRUD operations.
- JSON Format: Data is exchanged in JSON format, making it easy to work with in JavaScript and other programming languages.
- OData Protocol: Supports OData (Open Data Protocol), allowing for rich querying capabilities, including filtering, sorting, and pagination.
- Cross-Domain Requests: Can be accessed from client-side code in browser scenarios using CORS (Cross-Origin Resource Sharing).
Common Use Cases
- Retrieving list items and document libraries.
- Creating new list items or libraries.
- Updating existing items.
- Deleting items from lists or libraries.
- Executing complex queries and fetching related data.
Basic Example
To retrieve items from a SharePoint list using the REST API, you would perform a GET request to the following endpoint:
GET /_api/web/lists/getbytitle('ListName')/items
This will return a JSON array of items in the specified list.
Authentication
Accessing the REST API in SharePoint typically requires authentication. Depending on the environment (on-premises or SharePoint Online), you may use:
- OAuth tokens (for SharePoint Online)
- NTLM or Kerberos (for on-premises SharePoint)
- [Microsoft Documentation on SharePoint REST API](https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest)
- [OData Documentation](https://www.odata.org/)
Example REST APIs:
Tools:
SharePoint Articles