Top Banner
Gaining the Knowledge of the Open Data Protocol (OData) PRAIRIE DEVCON 2015 CHRIS WOODRUFF
41
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gaining the Knowledge of the Open Data Protocol (OData) - Prairie Dev Con

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

CHRIS WOODRUFF

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

Hi, I’m Woody!

• Chris Woodruff

[email protected]

• http://chriswoodruff.com

• http://deepfriedbytes.com

• twitter @cwoodruff

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

THE AGENDA

BACKGROUNDOF ODATA

UNDERSTANDINGODATA

PROTOCOL

CONSUME ODATAWITH

TESTING TOOLS

PRODUCE ANODATA FEED

USING RESTier

CONSUME ODATAWITH AN

UNIVERSAL APP

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

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?

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

BACKGROUND OF ODATA

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

ISSUE Data APIs frequently

create more problems than solutions

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

Facebook: What fields

will I get when I read

a post?

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

Facebook: How do you like a

post?

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

HOW DO DEVELOPERS KNOW WHAT TO DO?

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

I GUESS THEY USE DOCS

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

SO IS THERE REALLY A PROBLEM?

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

CAN ODATA MAGICALLY CURE THE PROBLEM?

NO BUT IT CAN HELP!

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

UNDERSTANDING ODATA PROTOCOL

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

2007PROJECT ASTORIA

2007ADO.NET DATA SERVICES

2008WCF DATA SERVICES

2013ODATA PART OF WEB API

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

2012ODATA V3 RELEASED

2014ODATA v4 RELEASED

2015RESTier FRAMEWORK

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

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

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

CRUD

PUTGET

POST DELETE

SELECT

INSERT

UPDATE

FULL SQL LIKE QUERY “LANGUAGE”

DELETE

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

SERVICE METADATA DOCUMENT

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

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

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

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

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

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

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

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

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

JSON FORMAT

FRIENDLY TO JAVASCRIPT01

02

03

04

90% MORE COMPACT

READS LIKE A CUSTOM API

VERY LITTLE ODATA “GUNK”

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

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

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

OTHER ODATA CAPABILITIES

ACTIONS AND FUNCTIONS ALLOW HYPERMEDIA-BASED METHODS

01

02

03

DEFINED CONVENTIONS FOR PATCH AND DEEP INSERTS

VOCABULARIES

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

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

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

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

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

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!!

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

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

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

WHAT DOES ODATA GIVE ME AND MY ORGANIZATION?

EMPOWER INTERNAL KNOWLEDGE WORKS

EMPOWER EXISTING OR FUTURE COSTOMERS

MONITIZE DATA FOR UNTAPPED REVENUE

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

CONSUME ODATA WITH TESTING TOOLS

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

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

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

Demo

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

PRODUCE AN ODATA FEED USING RESTier

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

Demo

www.chriswoodruff.com Page Number 35

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

CONSUME ODATA WITH AN UNIVERSAL APP

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

Demo

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

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

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

GITHUB

http://github.com/cwoodruffProjects:

ChinookOData

ChinookWebAPIOData

BaseballStatsODatav4RESTier

Where can you find the source for this talk?

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

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

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

THANK YOU

Find me around the conference and would enjoy chatting

Email: [email protected]

Twitter: @cwoodruff