41
Gaining the Knowledge of the Open Data Protocol (OData) PRAIRIE DEVCON 2015 CHRIS WOODRUFF

Gaining the Knowledge of the Open Data Protocol (OData) - Prairie Dev Con

Embed Size (px)

Citation preview

Gaining the Knowledge of the Open Data Protocol (OData)PRAIRIE DEVCON 2015

CHRIS WOODRUFF

Hi, I’m Woody!

• Chris Woodruff

[email protected]

• http://chriswoodruff.com

• http://deepfriedbytes.com

• twitter @cwoodruff

THE AGENDA

BACKGROUNDOF ODATA

UNDERSTANDINGODATA

PROTOCOL

CONSUME ODATAWITH

TESTING TOOLS

PRODUCE ANODATA FEED

USING RESTier

CONSUME ODATAWITH AN

UNIVERSAL APP

SURVEY

DATA

API

…are comfortable w/ HTTP and

XML? JSON?

…have created a Data API?

…knows what the web is?

…have a basic understanding of the

term REST?

BACKGROUND OF ODATA

ISSUE Data APIs frequently

create more problems than solutions

Facebook: What fields

will I get when I read

a post?

Facebook: How do you like a

post?

HOW DO DEVELOPERS KNOW WHAT TO DO?

I GUESS THEY USE DOCS

SO IS THERE REALLY A PROBLEM?

CAN ODATA MAGICALLY CURE THE PROBLEM?

NO BUT IT CAN HELP!

UNDERSTANDING ODATA PROTOCOL

2007PROJECT ASTORIA

2007ADO.NET DATA SERVICES

2008WCF DATA SERVICES

2013ODATA PART OF WEB API

2012ODATA V3 RELEASED

2014ODATA v4 RELEASED

2015RESTier FRAMEWORK

BASICS OF ODATA

1

Feeds, which are Collections of typed Entities

2

OData services can expose Actions and Functions (v4)

3

OData services expose all these constructs via URIs

4

OData service may also expose a Service Metadata Document

CRUD

PUTGET

POST DELETE

SELECT

INSERT

UPDATE

FULL SQL LIKE QUERY “LANGUAGE”

DELETE

SERVICE METADATA DOCUMENT

CONVENTIONS

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

\__________________________________/

|

service root URI

http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name

\__________________________________/ \________________/ \__________________/

| | |

service root URI resource path query options

URL CONVENTIONS

$FILTER/Suppliers?$filter=Address/City eq 'Redmond‘

01

$ORDERBY/Products?$orderby=ReleaseDate asc, Rating desc

02

$SELECT/Products?$select=*,Category/Name

03

$EXPAND/Products?$select=*,Category/Name&$expand=Category

04

$TOP $SKIP/Products?$top=5&$skip=2

05

COMBINING URL CONVENTIONS

http://<something>.svc/Players/?$skip=10

&$top=2

&filter=substringof(‘Wood',nameLast)

&$orderby=nameLast%20desc

&$select=nickname,yearBorn,nameFirst, nameLast

&$format=json

PAYLOAD CONVENTIONS

SUCCESS AND ERROR CODES200 OK, 201 Created, 415 Unsupported Media Type,

01

FORMATS• JSON• ATOM• JSON VERBOSE

02

NUANCESPATCH, Null payloads, etc

03

JSON FORMAT

FRIENDLY TO JAVASCRIPT01

02

03

04

90% MORE COMPACT

READS LIKE A CUSTOM API

VERY LITTLE ODATA “GUNK”

ATOM FORMAT

ATOM PARSERS EXIST EVERYWHERE01

02

03

04

ELEMENT FIELDS MAP TO THEIR ATOM COUNTERPARTS

GOOD EXAMPLE OF ODATA INTEROPERABILITY

CAN USE LIKE XML

OTHER ODATA CAPABILITIES

ACTIONS AND FUNCTIONS ALLOW HYPERMEDIA-BASED METHODS

01

02

03

DEFINED CONVENTIONS FOR PATCH AND DEEP INSERTS

VOCABULARIES

WHAT NOT TO DO WITH ODATA

NOT A FIT FOR HIGHLY OPINIONATED APIs

01

02

03

NOT GOOD FOR BULK DATA TRANSFER

HARD TO BUILD APIs THAT ARE RADICALLY DIFFERENT THAN BACKEND

ODATA DOESN’T SUPPORT ALL QUERIES

DOESN’T SUPPORT AGGREGATIONYou can’t ask for customers that have at

01

02

03

DOESN’T SUPPORT FILTER EXPANSIONYou can’t ask for a customer and only their orders placed in 2013

DOESN’T SUPPORT “GRAPH” QUERIESYou can ask friend-of-a-friend type queries, but there are limitations

The OASIS international open standards consortium announced

the approval of the Open Data Protocol (OData) 4.0 and the

OData JSON Format 4.0. These REST-based standards simplify

the querying and sharing of data across applications for re-use in

the enterprise, cloud, and mobile devices. With OData,

information can be accessed from a variety of sources including

relational databases, file systems, content management systems,

and traditional web sites. OData 4.0 and the OData JSON Format

4.0 are now official OASIS Standards, a status that signifies the

highest level of ratification.

RATIFIED MARCH 2014!!

THERE ARE MANY NON-MICROSOFT PEOPLE ON THE TC!!

ODATA IS A STANDARD!!

WHO USES ODATA?

ANDROID

.NET

JAVA

PHPiOS

.NET

JAVA

WINDOWS PHONE

JAVASCRIPT

RUBY, PHP AND MANY OTHERS

NODE.JS

MSSQL, MYSQL, DB2, INFORMIX, AZUE SQL

WINDOWS AZURE, SALESFORCE, SAP, MS CRM

JOOMLA, DRUPAL, GEOREST

WHAT DOES ODATA GIVE ME AND MY ORGANIZATION?

EMPOWER INTERNAL KNOWLEDGE WORKS

EMPOWER EXISTING OR FUTURE COSTOMERS

MONITIZE DATA FOR UNTAPPED REVENUE

CONSUME ODATA WITH TESTING TOOLS

XODATAWeb-based OData Visualizer

FIDDLERFree web debugging tool which logs all HTTP(S) traffic between

your computer and the Internet.

LINQPAD (v3)Interactively query SQL

databases (among other data sources such as OData or WCF Data Services) using LINQ, as

well as interactively writing C# code without the need for an

IDE.

ODATA VALIDATOR

Enable OData service authors to validate their

implementation against the OData specification to ensure the service interoperates well

with any OData client.

TESTING/DEBUGGING ODATA

www.websitename.comwww.chriswoodruff.com Page Number 32

Demo

PRODUCE AN ODATA FEED USING RESTier

Demo

www.chriswoodruff.com Page Number 35

CONSUME ODATA WITH AN UNIVERSAL APP

Demo

TOMORROW @ 2:30PM ROOM D

BEST PRACTICES

ADVANCED TOPICS SHARE ODATA IN UNIVERSAL APP

VALIDATION

Learning How to Shape

and Configure an OData

Feed for High Performing

Web Sites and Applications

GITHUB

http://github.com/cwoodruffProjects:

ChinookOData

ChinookWebAPIOData

BaseballStatsODatav4RESTier

Where can you find the source for this talk?

ODATA WORKSHOP

0102

0304

TESTING/DEBUGGING ODATA

DEVELPING CLIENT SIDE SOLUTIONS• Web Apps using Javascript to consume Odata• iOS Swift development for native iPhone and iPad

apps• Windows 8.1 and Windows Phone apps C# and WinJS• Android development using Java• Using Xamarin for consuming OData

LEARNING THE PROTOCOL• The Metadata and Service Model of OData

• URI Conventions of OData• Format Conventions of OData

• OData HTTP Conventions and Operations

DEVELPING SERVER SIDE SOLUTIONS• ASP.NET Web API

• Advanced Performance Tips and Best Practices

Go to http://ChrisWoodruff.com for more details and pricing

THANK YOU

Find me around the conference and would enjoy chatting

Email: [email protected]

Twitter: @cwoodruff