SlideShare une entreprise Scribd logo
1  sur  26
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
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

Contenu connexe

Tendances

Ransack ruby on rails - HuanND
Ransack ruby on rails - HuanNDRansack ruby on rails - HuanND
Ransack ruby on rails - HuanND
Framgia Vietnam
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
jQuery
jQueryjQuery
jQuery
i.omar
 
OData and SharePoint
OData and SharePointOData and SharePoint
OData and SharePoint
Sanjay Patel
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
Phil Wicklund
 

Tendances (19)

jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
 
Mimsy XG Resource Session
Mimsy XG Resource SessionMimsy XG Resource Session
Mimsy XG Resource Session
 
Angular Data
Angular DataAngular Data
Angular Data
 
Introduction to Jquery
Introduction to Jquery Introduction to Jquery
Introduction to Jquery
 
Ransack ruby on rails - HuanND
Ransack ruby on rails - HuanNDRansack ruby on rails - HuanND
Ransack ruby on rails - HuanND
 
SOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || SalesforceSOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || Salesforce
 
List and images in html
List and images in htmlList and images in html
List and images in html
 
Modulo para conectar un programa en vb 6
Modulo para conectar un programa en vb 6Modulo para conectar un programa en vb 6
Modulo para conectar un programa en vb 6
 
04.Navigation on Windows Phone
04.Navigation on Windows Phone04.Navigation on Windows Phone
04.Navigation on Windows Phone
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Routes Controllers
Routes ControllersRoutes Controllers
Routes Controllers
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST API
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Mule soft RAML API Designing
Mule soft RAML API DesigningMule soft RAML API Designing
Mule soft RAML API Designing
 
jQuery
jQueryjQuery
jQuery
 
ADL/U-SQL Introduction (SQLBits 2016)
ADL/U-SQL Introduction (SQLBits 2016)ADL/U-SQL Introduction (SQLBits 2016)
ADL/U-SQL Introduction (SQLBits 2016)
 
JSON and XML
JSON and XMLJSON and XML
JSON and XML
 
OData and SharePoint
OData and SharePointOData and SharePoint
OData and SharePoint
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
 

Similaire à OData RESTful implementation

JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
Talha Ocakçı
 
Java Web services
Java Web servicesJava Web services
Java Web services
Sujit Kumar
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & Middlewares
Santosh Wadghule
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
Gavin Roy
 

Similaire à OData RESTful implementation (20)

SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
Linked services
Linked servicesLinked services
Linked services
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
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...
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & Middlewares
 
AWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDBAWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDB
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and OData
 
Web Services
Web ServicesWeb Services
Web Services
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
MeteorJS Introduction
MeteorJS IntroductionMeteorJS Introduction
MeteorJS Introduction
 
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 ...
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 

Dernier

Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 

Dernier (20)

Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 

OData RESTful implementation

  • 1.
  • 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
  • 16.
  • 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