Why would anyone but the most pedestrian enterprise developer be interested in a data access protocol originally designed by Microsoft, implemented in XML and handed to OASIS for standardization? The Open Data Protocol, or OData for short, has evolved into a clean, RESTful interface for CRUD operations against data services. Alongside the usual enterprise suspects such as Microsoft, Salesforce and IBM, OData has been adopted by government and non-profit agencies to open up their data and make it accessible to the public. For developers wanting to consume data, or create their own OData services, there's no shortage of open source options, from Apache Olingo in Java to node-odata and ODataCpp. Whether you're accessing customer orders in SAP or the Whitehouse visitor book, you're going to need some OData smarts.
3. BUT…
• REST is a style, not a standard
• RESTful, RESTlike, RESTish
• URL parameters?
– e.g. retrieve only a subset of properties
• Retrieve a set of records via a query?
• Metadata
– WADL?
– RAML?
– Swagger?
4. Enter… OData
“OData is a standardized protocol for creating and
consuming data APIs.
OData builds on core protocols like HTTP and commonly
accepted methodologies like REST.
The result is a uniform way to expose
full-featured data APIs.”
www.odata.org
5. OData
• Proposed by Microsoft
– 2009
• Standardized by OASIS
– OData 4.0, 2014
6. OData
• URIs for resource identity
http://services.odata.org/V4/OData/OData.svc
/Products
?$filter=Rating+eq+3&$select=Rating,+Name
8. OData
• HTTP transport
– GET, POST, PUT/PATCH/MERGE, DELETE
GET /V4/OData/OData.svc/Products(1) HTTP/1.1
Host: services.odata.org
HTTP/1.1 200 OK
...
17. OData Examples
$ curl -H 'Prefer: odata.track-changes'
-H 'Prefer: odata.callback; url="https://myserver/cb?token=123"'
'http://services.odata.org/V4/OData/OData.svc/Products’
Server will POST notifications to the callback URL
Change Tracking
19. OData-Supporting Products
• Microsoft SQL Server
• Windows Azure Active Directory
• SAP NetWeaver
• IBM WebSphere
• JBoss Teiid
• Salesforce1 Lightning Connect
• Socrata Open Data Portal
22. OData Summary
• Standardizes data-centric web services
• Exposes Data and Metadata
• JSON or XML (Atom/AtomPub) representation over
HTTP
• Wide industry support
• Really not that clunky!