SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Odata Introduction
By Ahmad Dwedar
Andalusia Group
For Medical Services
ADS Department
 What is Odata ?
 Features of Odata
 OData Server Platforms
 Querying in Odata
 OData Operators
 Logical Operators
 Arithmetic Operators
 Odata Functions
 String Functions
 Date Functions
 Math Functions
 Odata Practical Example
Agenda
Andalusia Group
For Medical Services
ADS Department
 Open Data Protocol (OData) is an open protocol which allows
the creation and consumption of query able and interoperable
Restful APIs in a simple and standard way. Microsoft initiated
OData in 2007.
 The protocol enables the creation and consumption of REST
APIs, which allow Web clients to publish and edit resources,
identified using URLs and defined in a data model, using simple
HTTP messages. OData is not limited to relational databases.
What is Odata ?
Andalusia Group
For Medical Services
ADS Department
 Odata supports most of the Http verbs: Get, Post, Put, Delete,
Patch, Merge
 It supports three types of data formatting: Xml, Json, and Json
light
 It is platform and language independent
 No need to create proxy classes which we used to do it in web
service. We don't need to serialize the output data manually,
OData does the serialization for us
 open source, simple, flexible and light-weight
Features of Odata
Andalusia Group
For Medical Services
ADS Department
 WCF Data Services
 ASP.NET Web API
 Share Point
 MS SQL Server Reporting Services
 Windows Azure
 PHP, Java, IBM WebSphere/DB2/Informix
 For the entire list visit http://www.odata.org/ecosystem/
OData Server Platforms
Andalusia Group
For Medical Services
ADS Department
Querying in Odata
Option Example
$FILTER http://HMS:80/Api/EmployeesApi?$Filter=id eq 10
$SELECT http://HMS:80/Api/EmployeesApi?$Select=id,name,salary
$TOP http://HMS:80/Api/EmployeesApi?$Top=10
$SKIP http://HMS:80/Api/EmployeesApi?$Skip=5
$ORDERBY http://HMS:80/Api/EmployeesApi?$OrderBy=name desc
$INLINECOUNT http://HMS:80/Api/EmployeesApi?$Inlinecount
Andalusia Group
For Medical Services
ADS Department
Operator Explanation Example
AND And Operation http://HMS:80/Api/EmployeesApi?$Filter=Age gt 25 and IsActive eq true
OR Or Operation http://HMS:80/Api/EmployeesApi?$Filter=JobID eq 5 or JobID eq 8
NOT Not Operation http://HMS:80/Api/EmployeesApi?$Filter=not endswith(name,‘dwedar')
EQ Equal Check http://HMS:80/Api/EmployeesApi?$Filter=Salary eq 1000
NE Not Equal Check http://HMS:80/Api/EmployeesApi?$Filter=JobID ne 2
LT Less Than Check http://HMS:80/Api/EmployeesApi?$Filter=Salary lt 3000
GT Greater Than Check http://HMS:80/Api/EmployeesApi?$Filter=Salary gt 3000
LE Less Than Equal http://HMS:80/Api/EmployeesApi?$Filter=Age le 30
GE Greater Than Equal http://HMS:80/Api/EmployeesApi?$Filter=Age ge 21
OData Operators
Andalusia Group
For Medical Services
ADS Department
Logical Operators
Operator Explanation Example
Add Addition http://HMS:80/Api/Products?$filter=Price add 5 gt 10
Sub Subtraction http://HMS:80/Api/Products?$filter=Price sub 5 gt 10
Mul Multiplication http://HMS:80/Api/Products?$filter=Price mul 2 gt 2000
Div Division http://HMS:80/Api/Products?$filter=Price div 2 gt 4
Mod Modulo http://HMS:80/Api/Products?$filter=Price mod 2 eq 0
Grouping Precedence grouping http://HMS:80/Api/Products?$filter=(Price sub 5) gt 10
OData Operators
Andalusia Group
For Medical Services
ADS Department
Arithmetic Operators
Function Signature Example
substringof (string, string field) $filter=substringof('ahmad', Name) eq true
Endswith/Startswith (string field, string) $filter=endswith(Name, ‘dwedar') eq true
trim (string) $filter=trim(CompanyName) eq 'Andalusia Inc'
length (string) $filter=length(CompanyName) eq 13
indexof (string field, string) $filter=indexof(CompanyName, 'Andalusia') eq 1
replace (string field, string find,
string replace)
$filter=replace(CompanyName, ' ', '') eq 'AndalusiaInc'
substring (string field, int pos) $filter=substring(CompanyName, 1) eq 'Andalusia Inc'
substring (string field, int pos, int
length)
$filter=substring(CompanyName, 1, 2) eq ‘An'
Tolower/Toupper (string field) $filter=tolower(CompanyName) eq ‘andalusia'
concat (string field, string) $filter=concat(concat(City, ', '), Country) eq 'Berlin, Germany'
Odata Functions
Andalusia Group
For Medical Services
ADS Department
String Functions
Function Signature Example
day (DateTime field) $filter=day(BirthDate) eq 8
hour (DateTime field) $filter=hour(BirthDate) eq 0
minute (DateTime field) $filter=minute(BirthDate) eq 0
month (DateTime field) $filter=month(BirthDate) eq 12
second (DateTime field) $filter=second(BirthDate) eq 0
year (DateTime field) $filter=year(BirthDate) eq 1980
Odata Functions
Andalusia Group
For Medical Services
ADS Department
Date Functions
Function Signature Example
round (double/decimal Field) $filter=round(Price) eq 6
floor (double/decimal Field) $filter=floor(Price) eq 8
ceiling (double/decimal Field) $filter=ceiling(Price) eq 13
Odata Functions
Andalusia Group
For Medical Services
ADS Department
Math Functions
Odata
Andalusia Group
For Medical Services
ADS Department
Odata Practical
Example
References
Andalusia Group
For Medical Services
ADS Department
 http://www.odata.org/documentation/odata-version-
3-0/url-conventions/
 http://www.odata.org/documentation/odata-version-
3-0/odata-version-3-0-core-protocol/
 http://www.odata.org/documentation/odata-version-
2-0/uri-conventions/
 https://en.wikipedia.org/wiki/Open_Data_Protocol

Weitere ähnliche Inhalte

Ähnlich wie Odata introduction

Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...Eric D. Boyd
 
Document_format_for_OData_In_A_Nutshell.pdf
Document_format_for_OData_In_A_Nutshell.pdfDocument_format_for_OData_In_A_Nutshell.pdf
Document_format_for_OData_In_A_Nutshell.pdfdavidjpeace
 
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
 
Great APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGreat APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGabriel Lucaciu
 
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
 
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 ODataPace Integration
 
Wcf data services
Wcf data servicesWcf data services
Wcf data servicesEyal Vardi
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座Li Yi
 
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)Pat Patterson
 
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & ExtensibilityAsp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & ExtensibilityEyal Vardi
 
Data insertion api
Data insertion apiData insertion api
Data insertion apiAlok Sharma
 
SAP FIORI COEP Pune - pavan golesar (ppt)
SAP FIORI COEP Pune - pavan golesar (ppt)SAP FIORI COEP Pune - pavan golesar (ppt)
SAP FIORI COEP Pune - pavan golesar (ppt)Pavan Golesar
 
Metadata becomes alive via a web service between MDR and SAS
Metadata becomes alive via a web service between MDR and SASMetadata becomes alive via a web service between MDR and SAS
Metadata becomes alive via a web service between MDR and SASKevin Lee
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)Apigee | Google Cloud
 
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Indus Khaitan
 

Ähnlich wie Odata introduction (20)

Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
Consuming Data From Many Platforms: The Benefits of OData - St. Louis Day of ...
 
Document_format_for_OData_In_A_Nutshell.pdf
Document_format_for_OData_In_A_Nutshell.pdfDocument_format_for_OData_In_A_Nutshell.pdf
Document_format_for_OData_In_A_Nutshell.pdf
 
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)
 
Great APIs - Future of Your Progress App
Great APIs - Future of Your Progress AppGreat APIs - Future of Your Progress App
Great APIs - Future of Your Progress App
 
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)
 
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
 
Wcf data services
Wcf data servicesWcf data services
Wcf data services
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
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)
 
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & ExtensibilityAsp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
 
Data insertion api
Data insertion apiData insertion api
Data insertion api
 
Autodesk Technical Webinar: SAP NetWeaver Gateway Part 2
Autodesk Technical Webinar: SAP NetWeaver Gateway Part 2Autodesk Technical Webinar: SAP NetWeaver Gateway Part 2
Autodesk Technical Webinar: SAP NetWeaver Gateway Part 2
 
SAP FIORI COEP Pune - pavan golesar (ppt)
SAP FIORI COEP Pune - pavan golesar (ppt)SAP FIORI COEP Pune - pavan golesar (ppt)
SAP FIORI COEP Pune - pavan golesar (ppt)
 
Scribe online 04 o data connector
Scribe online 04   o data connectorScribe online 04   o data connector
Scribe online 04 o data connector
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Metadata becomes alive via a web service between MDR and SAS
Metadata becomes alive via a web service between MDR and SASMetadata becomes alive via a web service between MDR and SAS
Metadata becomes alive via a web service between MDR and SAS
 
RESTfulDay9
RESTfulDay9RESTfulDay9
RESTfulDay9
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
 
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
Creating Interactive Olap Applications With My Sql Enterprise And Mondrian Pr...
 

Kürzlich hochgeladen

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 slidevu2urc
 
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 WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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?Antenna Manufacturer Coco
 
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...Miguel Araújo
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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 FresherRemote DBA Services
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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?
 
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...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Odata introduction

  • 1. Odata Introduction By Ahmad Dwedar Andalusia Group For Medical Services ADS Department
  • 2.  What is Odata ?  Features of Odata  OData Server Platforms  Querying in Odata  OData Operators  Logical Operators  Arithmetic Operators  Odata Functions  String Functions  Date Functions  Math Functions  Odata Practical Example Agenda Andalusia Group For Medical Services ADS Department
  • 3.  Open Data Protocol (OData) is an open protocol which allows the creation and consumption of query able and interoperable Restful APIs in a simple and standard way. Microsoft initiated OData in 2007.  The protocol enables the creation and consumption of REST APIs, which allow Web clients to publish and edit resources, identified using URLs and defined in a data model, using simple HTTP messages. OData is not limited to relational databases. What is Odata ? Andalusia Group For Medical Services ADS Department
  • 4.  Odata supports most of the Http verbs: Get, Post, Put, Delete, Patch, Merge  It supports three types of data formatting: Xml, Json, and Json light  It is platform and language independent  No need to create proxy classes which we used to do it in web service. We don't need to serialize the output data manually, OData does the serialization for us  open source, simple, flexible and light-weight Features of Odata Andalusia Group For Medical Services ADS Department
  • 5.  WCF Data Services  ASP.NET Web API  Share Point  MS SQL Server Reporting Services  Windows Azure  PHP, Java, IBM WebSphere/DB2/Informix  For the entire list visit http://www.odata.org/ecosystem/ OData Server Platforms Andalusia Group For Medical Services ADS Department
  • 6. Querying in Odata Option Example $FILTER http://HMS:80/Api/EmployeesApi?$Filter=id eq 10 $SELECT http://HMS:80/Api/EmployeesApi?$Select=id,name,salary $TOP http://HMS:80/Api/EmployeesApi?$Top=10 $SKIP http://HMS:80/Api/EmployeesApi?$Skip=5 $ORDERBY http://HMS:80/Api/EmployeesApi?$OrderBy=name desc $INLINECOUNT http://HMS:80/Api/EmployeesApi?$Inlinecount Andalusia Group For Medical Services ADS Department
  • 7. Operator Explanation Example AND And Operation http://HMS:80/Api/EmployeesApi?$Filter=Age gt 25 and IsActive eq true OR Or Operation http://HMS:80/Api/EmployeesApi?$Filter=JobID eq 5 or JobID eq 8 NOT Not Operation http://HMS:80/Api/EmployeesApi?$Filter=not endswith(name,‘dwedar') EQ Equal Check http://HMS:80/Api/EmployeesApi?$Filter=Salary eq 1000 NE Not Equal Check http://HMS:80/Api/EmployeesApi?$Filter=JobID ne 2 LT Less Than Check http://HMS:80/Api/EmployeesApi?$Filter=Salary lt 3000 GT Greater Than Check http://HMS:80/Api/EmployeesApi?$Filter=Salary gt 3000 LE Less Than Equal http://HMS:80/Api/EmployeesApi?$Filter=Age le 30 GE Greater Than Equal http://HMS:80/Api/EmployeesApi?$Filter=Age ge 21 OData Operators Andalusia Group For Medical Services ADS Department Logical Operators
  • 8. Operator Explanation Example Add Addition http://HMS:80/Api/Products?$filter=Price add 5 gt 10 Sub Subtraction http://HMS:80/Api/Products?$filter=Price sub 5 gt 10 Mul Multiplication http://HMS:80/Api/Products?$filter=Price mul 2 gt 2000 Div Division http://HMS:80/Api/Products?$filter=Price div 2 gt 4 Mod Modulo http://HMS:80/Api/Products?$filter=Price mod 2 eq 0 Grouping Precedence grouping http://HMS:80/Api/Products?$filter=(Price sub 5) gt 10 OData Operators Andalusia Group For Medical Services ADS Department Arithmetic Operators
  • 9. Function Signature Example substringof (string, string field) $filter=substringof('ahmad', Name) eq true Endswith/Startswith (string field, string) $filter=endswith(Name, ‘dwedar') eq true trim (string) $filter=trim(CompanyName) eq 'Andalusia Inc' length (string) $filter=length(CompanyName) eq 13 indexof (string field, string) $filter=indexof(CompanyName, 'Andalusia') eq 1 replace (string field, string find, string replace) $filter=replace(CompanyName, ' ', '') eq 'AndalusiaInc' substring (string field, int pos) $filter=substring(CompanyName, 1) eq 'Andalusia Inc' substring (string field, int pos, int length) $filter=substring(CompanyName, 1, 2) eq ‘An' Tolower/Toupper (string field) $filter=tolower(CompanyName) eq ‘andalusia' concat (string field, string) $filter=concat(concat(City, ', '), Country) eq 'Berlin, Germany' Odata Functions Andalusia Group For Medical Services ADS Department String Functions
  • 10. Function Signature Example day (DateTime field) $filter=day(BirthDate) eq 8 hour (DateTime field) $filter=hour(BirthDate) eq 0 minute (DateTime field) $filter=minute(BirthDate) eq 0 month (DateTime field) $filter=month(BirthDate) eq 12 second (DateTime field) $filter=second(BirthDate) eq 0 year (DateTime field) $filter=year(BirthDate) eq 1980 Odata Functions Andalusia Group For Medical Services ADS Department Date Functions
  • 11. Function Signature Example round (double/decimal Field) $filter=round(Price) eq 6 floor (double/decimal Field) $filter=floor(Price) eq 8 ceiling (double/decimal Field) $filter=ceiling(Price) eq 13 Odata Functions Andalusia Group For Medical Services ADS Department Math Functions
  • 12. Odata Andalusia Group For Medical Services ADS Department Odata Practical Example
  • 13. References Andalusia Group For Medical Services ADS Department  http://www.odata.org/documentation/odata-version- 3-0/url-conventions/  http://www.odata.org/documentation/odata-version- 3-0/odata-version-3-0-core-protocol/  http://www.odata.org/documentation/odata-version- 2-0/uri-conventions/  https://en.wikipedia.org/wiki/Open_Data_Protocol