Definition:
OData(Open Data Protocol) is a standard that defines set of best practices for creating and consuming RESTful APIs.
- OData uses HTTP protocol for CRUD operations(HTTP POST, HTTP GET, HTTP PUT, HTTP DELETE)
- OData uses URI for resource identification. That means you can select the content/data using the URI, g. to get SharePoint list object - http://SiteURL/_api/web/lists/getbytitle('ListName')
- OData uses Atom XML or JSON format for response of the data
- Why do we need OData? – There is so much content/data on different platforms and in different formats, there’s no any common way to access them and OData defines a common approach to access those data
- Since SharePoint 2013, Microsoft has improved OData support in SharePoint. It supports full REST based interface so that developers can access (CRUD Operations) SharePoint content using REST API.
Response:
- Response of OData request can be in Atom XML or JSON format
- Generally Atom is used with managed clients and JSON is used with JavaScript/AJAX client
- HTTP header of the REST request should contain the format specified otherwise Atom will be taken as it is default format of the response.
Benefit:
- We can make the SharePoint data available on non-Microsoft platform and mobile devices as well.
- SharePoint can also connect and pull data from other OData sources.