0% found this document useful (0 votes)
2K views22 pages

OData Basics for Developers

OData is a web protocol for querying and updating data in a standardized way. It is built on HTTP and formats like JSON and AtomPub, enabling data to be available over the web through RESTful services. OData provides uniform ways of representing structured data, constructing URLs, and performing operations like GET, POST, PUT and DELETE. Services expose data through OData feeds that are collections of typed entries representing structured records.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views22 pages

OData Basics for Developers

OData is a web protocol for querying and updating data in a standardized way. It is built on HTTP and formats like JSON and AtomPub, enabling data to be available over the web through RESTful services. OData provides uniform ways of representing structured data, constructing URLs, and performing operations like GET, POST, PUT and DELETE. Services expose data through OData feeds that are collections of typed entries representing structured records.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

INTRODUCTION TO ODATA

WHAT IS ODATA

 A web protocol for querying and updating data.


 Built on top of technologies like http, AtomPub
and JSON.
 Enables a standardized way for data to be
available over the web.
 OData is RESTful service style as SOAP is to
RPC.
ODATA : UNIFORMITY

 Uniform way of representing structured data


– JSON & XML
 Uniform URL Conventions
– Navigation, Filtering, Sorting, Paging
 Uniform Operations
– GET, POST, PUT DELETE always mean the same
ODATA ORG
ATOM PROTOCOL

 OData is layer on top of Atom Publishing


Protocol.
 Atom is simple way of exposing ‘feed’ of data.
ODATA COMPONENTS

 A Service definition language


 Error handling

 Dataset paging

 Advanced Queries

 Batch requests

 Two request response formats : Atompub &


JSON
ODATA BASICS

 OData is composed of feeds, which are


collections of typed entries.
 Each entry represents a structured record with
a key.
 Entries can be part of type hierarchy

 Example :
http://services.odata.org/OData/OData.svc/Pr
oducts
SERVICE DOCUMENT

 OData service may contain one or more feeds.


 Service document lists all top level feeds.

 Sample Service Document :


http://services.odata.org/OData/OData.svc
 OData service can expose service specific
operations
SERVICE META DOCUMENT
 Service meta document describes the shape of
an OData service.
 Describes the Entity Data Model (EDM) of a
given service.
 Abstract data model of the resources exposed
by the service.
 Sample Meta Document :
http://services.odata.org/OData/OData.svc/$
metadata
ENTITY DATA MODEL

 EDM is the abstract data model used by the


OData Services.
 EDM is independent of underlying data
persistence format or implementation.
 Entities and Associations are main concepts in
EDM.
URI COMPONENTS

http://services.odata.org/OData/OData.svc/Categories
http://services.odata.org/OData/OData.svc/Categories(1)
http://services.odata.org/OData/OData.svc/Categories(1)/Name
http://services.odata.org/OData/OData.svc/Categories(1)/Products
http://services.odata.org/OData/OData.svc/Categories(1)/Products/$count
http://services.odata.org/OData/OData.svc/Categories(1)/Products(1)/Supplie
r/Address/City
http://services.odata.org/OData/OData.svc/Categories(1)/Products(1)/Supplie
r/Address/City/$value
http://services.odata.org/OData/OData.svc/Categories(1)/$links/Products
SERVICE OPERATIONS

 OData services can expose service operations,


which are simple functions.
 A service operation can accept primitive type
input parameters.
 Can be defined to return a single or collection
of primitive, complex type, entries or void.
 http://services.odata.org/OData/OData.svc/Pr
oductsByColor?color=%27red%27
QUERY STRING OPTIONS

 System Query Options ($orderby, $top, $skip,


$filter, $select)
 Expand query option ($expand). Eager Loading

 http://services.odata.org/OData/OData.svc/Ca
tegories?$expand=Products
 http://services.odata.org/OData/OData.svc/Pr
oducts?$select=Price,Name
ODATA OPERATIONS
WCF DATA SERVICE

 WCF Data services enables the creation and


consumption of OData services for the web.
 Demo with VS2010, ADO.NET Entity Model,
Northwind DB and WCF Data Service.
SERVER PAGING IN DATA SERVICES

 Allow the service author to limit the size of


response to a query.
 For queries that exceeds size limit:
 Partial response is returned without exceeding the
size limit.
 In addition a link to get the rest of the results.
SERVER PAGING
SHAREPOINT & ODATA

 Every Sharepoint 2010 server is Data Services


server.
 Supports ATOM & JSON formats.

 Enables client integration with sharepoint from


any platform & any language.
CUSTOM DATA SERVICE PROVIDER

 Data services sits on top of Data service


provider.
 Entity Framework

 LINQ to SQL DataContext

 Custom Service Provider – IDataService


Metadata, Query, Update, Paging, Stream
Provider
 For more details on custom DSP see here
GDATA

 Google has GData protocol for accessing


Calendar, Youtube.
 Limited only to Google Services.

 OData is an attempt to open up server side of


the protocol.
CONCLUSION

 Simple, Uniform way of sharing data at the


protocol level.
 Enables broad integration across products and
breaks data silos.
 All you need is Http stack to integrate with any
OData producer.
 Sharepoint and Office betting on OData.
REFERENCES

 http://www.odata.org
 http://www.odataprimer.com

You might also like