22
INTRODUCTION TO ODATA

Introduction to o data

Embed Size (px)

Citation preview

Page 1: Introduction to o data

INTRODUCTION TO ODATA

Page 2: Introduction to o data

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.

Page 3: Introduction to o data

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

Page 4: Introduction to o data

ODATA ORG

Page 5: Introduction to o data

ATOM PROTOCOL

OData is layer on top of Atom Publishing

Protocol.

Atom is simple way of exposing ‘feed’ of

data.

Page 6: Introduction to o data

ODATA COMPONENTS

A Service definition language

Error handling

Dataset paging

Advanced Queries

Batch requests

Two request response formats : Atompub &

JSON

Page 7: Introduction to o data

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

Page 8: Introduction to o data

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

Page 9: Introduction to o data

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

Page 10: Introduction to o data

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.

Page 11: Introduction to o data

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)/Suppl

ier/Address/City

http://services.odata.org/OData/OData.svc/Categories(1)/Products(1)/Suppl

ier/Address/City/$value

http://services.odata.org/OData/OData.svc/Categories(1)/$links/Products

Page 12: Introduction to o data

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/G

etProductsByRating?rating=4

Page 13: Introduction to o data

QUERY STRING OPTIONS

System Query Options ($orderby, $top,

$skip, $filter, $select)

Expand query option ($expand). Eager

Loading

http://services.odata.org/OData/OData.svc/C

ategories?$expand=Products

http://services.odata.org/OData/OData.svc/Pr

oducts?$select=Price,Name

Page 14: Introduction to o data

ODATA OPERATIONS

Page 15: Introduction to o data

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.

Page 16: Introduction to o data

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.

Page 17: Introduction to o data

SERVER PAGING

Page 18: Introduction to o data

SHAREPOINT & ODATA

Every Sharepoint 2010 server is Data

Services server.

Supports ATOM & JSON formats.

Enables client integration with sharepoint

from any platform & any language.

Page 19: Introduction to o data

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

Page 20: Introduction to o data

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.

Page 21: Introduction to o data

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.

Page 22: Introduction to o data

REFERENCES

http://www.odata.org

http://www.odataprimer.com