SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Gaining the Knowledge of the
Open Data Protocol (OData)
Chris Woodruff
Director, Perficient
Level: Intermediate
Who I am?
Chris Woodruff
MVP, Visual C#
Director at Perficient
Co-host of Deep Fried Bytes Podcast
@cwoodruff / cwoodruff@live.com / Skype: cwoodruff
You will learn:
•

Understand the background of OData

•

Have an understanding of the OData
protocol

•

How to produce an OData feed using
WCF Data Services

•

How to produce an OData feed using
ASP.NET Web API

•

How to consume an OData feed using
LINQ
Knowledge of OData

BACKGROUND
Quote
Jim Gray

Today, the tools for
capturing data both at
the mega-scale and at
the milli-scale are just
dreadful. After you have
captured the data, you
need to curate it before
you can start doing any
kind of data analysis,
and we lack good tools
for both data curation
and data analysis.
Problem: Data APIs
frequently create more
problems than solutions
THIS TALK IS ABOUT ONE SOLUTION.
Survey
…knows what the web is

…are comfortable w/ HTTP
and XML? JSON?
…have a basic understanding
of the term REST

…have created a Data API
Is there really a problem?
What is it?
QUIZ TIME
Facebook: What fields will I get
when I read a post?
Facebook: How do you like a
post?
SO GIVEN THAT NOBODY KNEW THE ANSWERS TO THESE
QUESTIONS,

How do developers know
what to do?
I guess they use docs
So is there really a
problem?
Yes
DEVELOPERS DON’T HAVE TIME TO ACTUALLY READ THE
DOCS
Can OData Magically cure
the problem? No, but it can
help.
LET’S SEE HOW
Knowledge of OData

THE PROTOCOL
The Basics of OData
Feeds, which are Collections of typed
Entities

OData services can expose Actions and
Functions (v4), Services (v3)
OData services expose all these constructs
via URIs
OData service may also expose a Service
Metadata Document
Full SQL like Query “Language”

HTTP Command
(Verb)
GET

SQL
Command
SELECT

PUT

UPDATE

POST

INSERT

DELETE

DELETE
The $metadata endpoint
URL 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‘

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

$top and $skip
/Products?$top=5&$skip=2

$select and $expand
/Products?$select=*,Category/Name&$expand=Category
Combining UEL Conventions

•

http://.../Players/
–?$skip=10
–&$top=2
–&filter=substringof(‘Wood',nameLast)

–&$orderby=nameLast%20desc
–&$select=nickname,yearBorn,nameFirst
–&$format=json
Payload Conventions
•

Success and error Codes
– 200 OK, 201 Created, 415 Unsupported Media Type,
etc

•

Overall Format
– JSON
– AtomPub
– JSON Verbose

•

Nuances
– PATCH, Null payloads, etc
JSON Format
•
•
•
•

Friendly to Javascript
90% more compact than AtomPub
Reads like a custom API
Very little OData “gunk”
Atom Format

•

•
•

Atom parsers exist in many frameworks
Element fields can be mapped to their
Atom counterparts
A good example of OData interoperability
What else can you do with OData?

•

•

•

Actions and Functions allow hypermediabased method calls (non-CRUD
operations)
Defined conventions for PATCH and deep
insert
Vocabularies
OData isn’t always the best fit

•

•
•

OData may not be a good fit for highly
opinionated APIs laden with developer
intent
OData may not be a good fit for bulk data
transfer
OData may not be a good fit for the APIs
that dramatically different in shape than
the backend
OData does not support all queries
•

OData doesn’t currently support
aggregation
– You can’t ask for customers that have at least 2
orders

•

OData doesn’t currently support filters
expansions
– You can’t ask for a customer and only their orders
placed in 2013

•

OData doesn't support “graph” queries
– You can ask friend-of-a-friend type queries, but there
are limitations
OData is becoming a standard
•
•

OASIS, ISO
ETA early 2014
Who uses OData?
What does OData give me and my
organization?
Empower Internal
Power Users

Empower Existing and
Future Customers

Monetize Data for
untapped Revenue
Knowledge of OData

CREATING FEED W/ WCF
DATA SERVICES
DEMO

WCF DATA SERVICES
Knowledge of OData

CREATING FEED W/
ASP.NET WEB API
DEMO

ASP.NET WEB API
OData Best Practices (Producer)
•

•

Always design your OData feed will
server-side paging if your entity
collections hold large amounts of data.
Looks at server-side validation of queries
and data updates based on the user
credentials sent through HTTP
Knowledge of OData

CONSUMING ODATA
What if Data API’s were like…

LINQ?
•

What are the last 50 invoices we sent?
– context.Invoice.OrderByDescending(i=>i.PostedAt).Take(50);

•

What are the invoices from the last 24 hours?
– context.Invoice.Where(i=>i.PostedAt > DateTime.Now.AddDays(-1));

•

How many $1M invoices have we sent?
– context.Invoice.Where(i=>i.TotalAmount >= 1000000);
DEMO

CONSUMING ODATA WITH
LINQ
OData Best Practices (Consumer)
•

•
•

Use Query Projection to only bring back
the entity properties you or your app
needs.
Think about client-side paging even if their
exists server-side paging.
Design and implement a client-side data
caching function in your app (unless
sensitive data).
Why are we excited!!
Knowledge of OData

WRAP-UP
The demo projects can be found at:

github.com/cwoodruff/
Resources

REST
http://www.ics.uci.edu/~taylor/documents/
2002-REST-TOIT.pdf

OData
http://odata.org

http://odataprimer.com
Contact Me

Chris “Woody” Woodruff
cwoodruff@live.com
Twitter @cwoodruff
Skype cwoodruff
http://chriswoodruff.com

http://deepfriedbytes.com

Weitere ähnliche Inhalte

Mehr von Woodruff Solutions LLC

Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
Woodruff Solutions LLC
 
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Woodruff Solutions LLC
 
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Woodruff Solutions LLC
 
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
Woodruff Solutions LLC
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
Woodruff Solutions LLC
 

Mehr von Woodruff Solutions LLC (19)

A Look at OData
A Look at ODataA Look at OData
A Look at OData
 
The Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile AppThe Top Tips You need to Learn about Data in your Mobile App
The Top Tips You need to Learn about Data in your Mobile App
 
Learning How to Shape and Configure an OData Service for High Performing Web ...
Learning How to Shape and Configure an OData Service for High Performing Web ...Learning How to Shape and Configure an OData Service for High Performing Web ...
Learning How to Shape and Configure an OData Service for High Performing Web ...
 
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
 
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
 
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
 
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
 
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
 
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
 
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
 
Sql Azure Data Sync
Sql Azure Data SyncSql Azure Data Sync
Sql Azure Data Sync
 
Producing an OData feed in 10 minutes
Producing an OData feed in 10 minutesProducing an OData feed in 10 minutes
Producing an OData feed in 10 minutes
 
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is RevolutionaryBuild Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is Revolutionary
 
Sailing on the ocean of 1s and 0s
Sailing on the ocean of 1s and 0sSailing on the ocean of 1s and 0s
Sailing on the ocean of 1s and 0s
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Gaining the Knowledge of the Open Data Protocol (OData)