SlideShare a Scribd company logo
OData RESTful implementation
REST WEB SERVICES
Β» SOAP (Service Oriented) and REST (Resource Oriented)
Β» REpresentational State Transfer
Β» REST Principles: Client-Server, Stateless, Cacheable, Layered
system, Code on demand, Uniform Interface, Identification of
resources, Manipulation of resources, self-descriptive messages
Β» REST API is an architecture that adheres to the above principles.
Β» Simple words: JSON interaction with a client application. Content negotiation
made clearer using REST.
Β» ODATA is a protocol. It solves specific problem faced in REST API design.
ODATA KEY FEATURES OVER WEB API
β€’ Query able and Interoperable RESTful API
β€’ Containment of Dependent Objects (Child Objects)
β€’ Deferred Execution
β€’ Easy Query Conventions
β€’ Powerful data reading capability
ODATA REST IMPLEMENTATION EXAMPLE
I will be showing an example where I implemented an OData Service. I will
be
focussing mainly on the HTTP GET of the ODATA.
The next following pages will be:
β€’ Tables used for this example
β€’ OData REST page using swagger integration.
β€’ Queries used with example
β€’ Project Settings
TABLES USED
MY ODATA REST SERVICE PAGE
$SELECT
$TOP
$SKIP
$EXPAND
$expand Query: Posts($select=Title;$expand=TypeOfPosts($select=Type))
Post (Child entity of Blog) & TypeOfPost (Child entity of Post)
Note: Refer table diagram in Slide 5 for tables’ relationship. Response Body is shown partially below.
$COUNT
$ORDERBY
$FILTER
This particular query can be used in various combinations.
β€’ Comparative $filter - contains, eq – equal, ne- not equals, lt – less than,
gt – greater than, le – less than and equals, ge- greater than and equals
β€’ Nested $filter - $filter used against other query options. (e.g. $expand
with $filter)
β€’ Conditional $filter - and, or, not
β€’ Lambda/anonymous $filter – any, all
β€’ Arithmetic $filter - Add – addition , mul – multiplication , div – division ,
sub – subtraction .
NOTE: Arithmetic and Conditional $filter will not have my project example
as they do not relate to my sample ODATA project. I have provided
another suitable example.
COMPARATIVE $FILTER
Reverse lookup example: contains(Name,
β€˜sel’)
Another example: Name eq β€˜Russell Watson’
NESTED $FILTER CONDITIONAL $FILTER
Example: $filter = (Section eq β€˜IT’) and not (SubjectCode eq
β€˜10026’)
LAMBDA $FILTER
Another example: Posts/any(vr:vr/Title eq β€˜IOO1’)
Example: $filter = AmountOfCash div NumberOfRecords gt 10
ARITHMETIC $Filter
OData RESTful implementation
CREATE DEFAULT MVC WEB API
ADD NEW CONTROLLER FOR ODATA
CREATE DATA MODELS
DB CONTEXT
MODIFY ODATA CONTROLLER
NOTE: By default, Odata Controller’s Enable Query retrieves inline entities up to 2
levels. More than 2 levels need to be mentioned explicitly by Max Expansion
Depth.
ODATA CONFIG
SWAGGER CONFIG (OPTIONAL)
NOTE: This setting will be needed if you want to test this in swagger tool.
WEB API CONFIG
GLOBAL ASAX
SUMMARY
By the end of this presentation, I hope you can make use of ODATA in a RESTful
manner. OData has been for many years and has been overly underrated.
With this presentation, we have covered:
β€’ REST service
β€’ Highlights of ODATA
β€’ ODATA Implementation
β€’ ODATA Query options
β€’ ODATA Project setup
Please have a read through in the blog for OData for more information.
https://www.odata.org/
THANK YOU

More Related Content

PDF
Elasticsearch and Symfony Integration - Debarko De
PDF
cake phptutorial
Β 
PDF
A Practical Guide to Hypermedia APIs
PPTX
Querying with Rails
PPTX
Angularjs scope part 02
KEY
Rest
PPTX
Basic concept of js
PPTX
YQL Publicis Hackday
Elasticsearch and Symfony Integration - Debarko De
cake phptutorial
Β 
A Practical Guide to Hypermedia APIs
Querying with Rails
Angularjs scope part 02
Rest
Basic concept of js
YQL Publicis Hackday

What's hot (19)

PPTX
jQuery basics for Beginners
PPTX
Mimsy XG Resource Session
PDF
Angular Data
PDF
Introduction to Jquery
PPT
Ransack ruby on rails - HuanND
PPTX
SOQL in salesforce || Salesforce Object Query Language || Salesforce
PPTX
List and images in html
DOCX
Modulo para conectar un programa en vb 6
PDF
04.Navigation on Windows Phone
PPTX
Chapter 15
KEY
Routes Controllers
PPTX
Introduction to the SharePoint 2013 REST API
PPTX
Data Access Options in SharePoint 2010
PPTX
Mule soft RAML API Designing
PPTX
jQuery
Β 
PPTX
ADL/U-SQL Introduction (SQLBits 2016)
PPTX
JSON and XML
PPTX
OData and SharePoint
PPTX
SharePoint 2010 Client-side Object Model
jQuery basics for Beginners
Mimsy XG Resource Session
Angular Data
Introduction to Jquery
Ransack ruby on rails - HuanND
SOQL in salesforce || Salesforce Object Query Language || Salesforce
List and images in html
Modulo para conectar un programa en vb 6
04.Navigation on Windows Phone
Chapter 15
Routes Controllers
Introduction to the SharePoint 2013 REST API
Data Access Options in SharePoint 2010
Mule soft RAML API Designing
jQuery
Β 
ADL/U-SQL Introduction (SQLBits 2016)
JSON and XML
OData and SharePoint
SharePoint 2010 Client-side Object Model
Ad

Similar to OData RESTful implementation (20)

PDF
SAP ODATA Overview & Guidelines
PPTX
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
KEY
Linked services
PDF
JAVA EE DEVELOPMENT (JSP and Servlets)
PPTX
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
PPTX
Java Web services
PPTX
StackMate - CloudFormation for CloudStack
PPTX
Building RESTfull Data Services with WebAPI
PPTX
Rails Request & Middlewares
PPT
Rest introduction
PPTX
Ntg web services
PDF
An Introduction to Tornado
PDF
MuleSoft London Community February 2020 - MuleSoft and OData
PDF
Web Services
PPTX
Session 29 - Servlets - Part 5
PPT
Ruby On Rails Siddhesh
PDF
MeteorJS Introduction
PPTX
Learning How to Shape and Configure an OData Service for High Performing Web ...
PDF
Alternatives of JPA/Hibernate
PDF
Apache Olingo - ApacheCon Denver 2014
SAP ODATA Overview & Guidelines
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
Linked services
JAVA EE DEVELOPMENT (JSP and Servlets)
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Java Web services
StackMate - CloudFormation for CloudStack
Building RESTfull Data Services with WebAPI
Rails Request & Middlewares
Rest introduction
Ntg web services
An Introduction to Tornado
MuleSoft London Community February 2020 - MuleSoft and OData
Web Services
Session 29 - Servlets - Part 5
Ruby On Rails Siddhesh
MeteorJS Introduction
Learning How to Shape and Configure an OData Service for High Performing Web ...
Alternatives of JPA/Hibernate
Apache Olingo - ApacheCon Denver 2014
Ad

Recently uploaded (20)

PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
artificial intelligence overview of it and more
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
DOCX
Unit-3 cyber security network security of internet system
PPT
tcp ip networks nd ip layering assotred slides
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Introduction to Information and Communication Technology
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Introduction to the IoT system, how the IoT system works
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
artificial intelligence overview of it and more
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Unit-3 cyber security network security of internet system
tcp ip networks nd ip layering assotred slides
The Internet -By the Numbers, Sri Lanka Edition
Β 
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Unit-1 introduction to cyber security discuss about how to secure a system
Introduction to Information and Communication Technology
SAP Ariba Sourcing PPT for learning material
INTERNET------BASICS-------UPDATED PPT PRESENTATION
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
522797556-Unit-2-Temperature-measurement-1-1.pptx
Job_Card_System_Styled_lorem_ipsum_.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Introduction to the IoT system, how the IoT system works
Cloud-Scale Log Monitoring _ Datadog.pdf
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 

OData RESTful implementation

  • 2. REST WEB SERVICES Β» SOAP (Service Oriented) and REST (Resource Oriented) Β» REpresentational State Transfer Β» REST Principles: Client-Server, Stateless, Cacheable, Layered system, Code on demand, Uniform Interface, Identification of resources, Manipulation of resources, self-descriptive messages Β» REST API is an architecture that adheres to the above principles. Β» Simple words: JSON interaction with a client application. Content negotiation made clearer using REST. Β» ODATA is a protocol. It solves specific problem faced in REST API design.
  • 3. ODATA KEY FEATURES OVER WEB API β€’ Query able and Interoperable RESTful API β€’ Containment of Dependent Objects (Child Objects) β€’ Deferred Execution β€’ Easy Query Conventions β€’ Powerful data reading capability
  • 4. ODATA REST IMPLEMENTATION EXAMPLE I will be showing an example where I implemented an OData Service. I will be focussing mainly on the HTTP GET of the ODATA. The next following pages will be: β€’ Tables used for this example β€’ OData REST page using swagger integration. β€’ Queries used with example β€’ Project Settings
  • 6. MY ODATA REST SERVICE PAGE
  • 10. $EXPAND $expand Query: Posts($select=Title;$expand=TypeOfPosts($select=Type)) Post (Child entity of Blog) & TypeOfPost (Child entity of Post) Note: Refer table diagram in Slide 5 for tables’ relationship. Response Body is shown partially below.
  • 13. $FILTER This particular query can be used in various combinations. β€’ Comparative $filter - contains, eq – equal, ne- not equals, lt – less than, gt – greater than, le – less than and equals, ge- greater than and equals β€’ Nested $filter - $filter used against other query options. (e.g. $expand with $filter) β€’ Conditional $filter - and, or, not β€’ Lambda/anonymous $filter – any, all β€’ Arithmetic $filter - Add – addition , mul – multiplication , div – division , sub – subtraction . NOTE: Arithmetic and Conditional $filter will not have my project example as they do not relate to my sample ODATA project. I have provided another suitable example.
  • 14. COMPARATIVE $FILTER Reverse lookup example: contains(Name, β€˜sel’) Another example: Name eq β€˜Russell Watson’ NESTED $FILTER CONDITIONAL $FILTER Example: $filter = (Section eq β€˜IT’) and not (SubjectCode eq β€˜10026’)
  • 15. LAMBDA $FILTER Another example: Posts/any(vr:vr/Title eq β€˜IOO1’) Example: $filter = AmountOfCash div NumberOfRecords gt 10 ARITHMETIC $Filter
  • 18. ADD NEW CONTROLLER FOR ODATA
  • 21. MODIFY ODATA CONTROLLER NOTE: By default, Odata Controller’s Enable Query retrieves inline entities up to 2 levels. More than 2 levels need to be mentioned explicitly by Max Expansion Depth.
  • 23. SWAGGER CONFIG (OPTIONAL) NOTE: This setting will be needed if you want to test this in swagger tool.
  • 26. SUMMARY By the end of this presentation, I hope you can make use of ODATA in a RESTful manner. OData has been for many years and has been overly underrated. With this presentation, we have covered: β€’ REST service β€’ Highlights of ODATA β€’ ODATA Implementation β€’ ODATA Query options β€’ ODATA Project setup Please have a read through in the blog for OData for more information. https://www.odata.org/ THANK YOU