OData and Impact on
API Design


With
Anant Jhingran   Brian Pagano   Greg Brail
@jhingran        @brianpagano   @gbrail
groups.google.com/group/api-craft
youtube.com/apigee
slideshare.net/apigee
   Introductions
   OData Primer
   API Design
   The OData Community
   Conclusions
@jhingran   @brianpagano   @gbrail
Interactions are shifting to edge of enterprise


               Social                                            Business
               Networks                                          Networks




                          Your apps                   Your
                          Your Data     Your          Web Site
                                      Company




                                      Your Store




                                       APIs
What the means is that
you’ve think about “data” –
what you expose, and what                      Apps
you collect “differently”
        - API-centric
Exposing data attracts
 business to the core even
 if data is not your core
 business




See Amundsen’s Dogs, Information Halos and APIs:
The epic story of your API Strategy »

http://blog.apigee.com/detail/api_strategy_talk_web_2.0/
Exposing Data is more than the “R” of CRUD in REST


                  GOOD CLEAN API’S




                M(E/A)SS OF
                INTERCONNECTED DATA




   How do you go from the m(e/a)ss to clean APIs?
Two schools of thought


               REST APIS                         REST APIS




           1           N




 Table1                    Table2



                                    “Linked Data” view – individual
“Schema-ed” Relational or
                                    objects, with properties and
Relational-like view of “data”
                                    interconnections
REST APIS


        1       N




Today we’ll discuss the “Schema-ed” view of the
world, and in particular, the OData approach
Let’s look at OData requests and responses.
OData by Example
SQL Query                                   OData Request

select * from products where id = 1         /Products(1)

select * from products                      /Products?$filter=name eq ‘Milk’
where name = ‘Milk’

select name from products                   /Products?$select=name


select * from products order by name        /Products?$orderby=name


select * from products offset 10 limit 10   /Products?$top=10&$skip=10


select * from prices r, products p          /Products(1)?$expand=Prices
where r.id = p.id
                          (* sort of)
Filters
/Categories?$filter=Name eq ‘Dairy’
Logical Operators
eq ne gt ge lt le eq or and

Arithmetic Operators
add sub mul div mod

Parenthesis Operator
()

Canonical Functions
substrof endswith startswith
length indexof replace substring tolower
toupper trim concat year years month day
days hour hours minute minutes second
seconds round floor ceiling isof cast
Format

/Categories?$format=json                                 *


atom json xml

(plus any other IANA-defined media types)

*If the $format query option is present in a request URI it takes
precedence over the value(s) specified in the Accept request header.
Metadata
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
  <edmx:DataServices
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
    m:DataServiceVersion="1.0">
    <Schema Namespace="NorthwindModel"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
      <EntityType Name="Category">
        <Key>
          <PropertyRef Name="CategoryID" />
        </Key>
        <Property Name="CategoryID" Type="Edm.Int32" Nullable="false"
          p8:StoreGeneratedPattern="Identity"
          xmlns:p8="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
        <Property Name="CategoryName" Type="Edm.String" Nullable="false"
          MaxLength="15" Unicode="true" FixedLength="false" />
        <Property Name="Description" Type="Edm.String" Nullable="true" MaxLength="Max"
          Unicode="true" FixedLength="false" />
      </EntityType>
  </Schema>
  </edmx:DataServices>
</edmx:Edmx>
Libraries
from http://www.odata.org/libraries
WTF is WCF?
Who is using OData?
Who created OData?
How does OData compare to other approaches?
OData or Not?

 Odata Request                      Web API Style

 /Products(1)                       /Products/1

 /Products?$filter=name eq ‘Milk’   /Products?name=Milk


 /Products/1?$select=name           /Products/1/name


 /Products?$orderby=name            /Products?orderby=name


 /Products?$top=10&$skip=10         /Products?offset=10&limit=10


 /Products(1)?$expand=Prices        /Products/1?expand=Prices
   OData
   GData
   SOAP
   Observed API Patterns on the Web
How active is community support for OData?
Is it time to rally around a standard like OData?

Or is too early?
Should one implement OData?
Questions
THANK YOU
Questions and ideas to:
groups.google.com/group/api-craft

Anant Jhingran       Brian Pagano   Greg Brail
@jhingran            @brianpagano   @gbrail

OData Introduction and Impact on API Design (Webcast)

  • 1.
    OData and Impacton API Design With Anant Jhingran Brian Pagano Greg Brail @jhingran @brianpagano @gbrail
  • 2.
  • 3.
  • 4.
  • 5.
    Introductions  OData Primer  API Design  The OData Community  Conclusions
  • 6.
    @jhingran @brianpagano @gbrail
  • 7.
    Interactions are shiftingto edge of enterprise Social Business Networks Networks Your apps Your Your Data Your Web Site Company Your Store APIs What the means is that you’ve think about “data” – what you expose, and what Apps you collect “differently” - API-centric
  • 8.
    Exposing data attracts business to the core even if data is not your core business See Amundsen’s Dogs, Information Halos and APIs: The epic story of your API Strategy » http://blog.apigee.com/detail/api_strategy_talk_web_2.0/
  • 9.
    Exposing Data ismore than the “R” of CRUD in REST GOOD CLEAN API’S M(E/A)SS OF INTERCONNECTED DATA How do you go from the m(e/a)ss to clean APIs?
  • 10.
    Two schools ofthought REST APIS REST APIS 1 N Table1 Table2 “Linked Data” view – individual “Schema-ed” Relational or objects, with properties and Relational-like view of “data” interconnections
  • 11.
    REST APIS 1 N Today we’ll discuss the “Schema-ed” view of the world, and in particular, the OData approach
  • 12.
    Let’s look atOData requests and responses.
  • 13.
    OData by Example SQLQuery OData Request select * from products where id = 1 /Products(1) select * from products /Products?$filter=name eq ‘Milk’ where name = ‘Milk’ select name from products /Products?$select=name select * from products order by name /Products?$orderby=name select * from products offset 10 limit 10 /Products?$top=10&$skip=10 select * from prices r, products p /Products(1)?$expand=Prices where r.id = p.id (* sort of)
  • 14.
    Filters /Categories?$filter=Name eq ‘Dairy’ LogicalOperators eq ne gt ge lt le eq or and Arithmetic Operators add sub mul div mod Parenthesis Operator () Canonical Functions substrof endswith startswith length indexof replace substring tolower toupper trim concat year years month day days hour hours minute minutes second seconds round floor ceiling isof cast
  • 15.
    Format /Categories?$format=json * atom json xml (plus any other IANA-defined media types) *If the $format query option is present in a request URI it takes precedence over the value(s) specified in the Accept request header.
  • 16.
    Metadata <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0"> <Schema Namespace="NorthwindModel" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"> <EntityType Name="Category"> <Key> <PropertyRef Name="CategoryID" /> </Key> <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" p8:StoreGeneratedPattern="Identity" xmlns:p8="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" /> <Property Name="Description" Type="Edm.String" Nullable="true" MaxLength="Max" Unicode="true" FixedLength="false" /> </EntityType> </Schema> </edmx:DataServices> </edmx:Edmx>
  • 17.
  • 18.
  • 19.
  • 20.
  • 22.
  • 24.
    How does ODatacompare to other approaches?
  • 25.
    OData or Not? Odata Request Web API Style /Products(1) /Products/1 /Products?$filter=name eq ‘Milk’ /Products?name=Milk /Products/1?$select=name /Products/1/name /Products?$orderby=name /Products?orderby=name /Products?$top=10&$skip=10 /Products?offset=10&limit=10 /Products(1)?$expand=Prices /Products/1?expand=Prices
  • 26.
    OData  GData  SOAP  Observed API Patterns on the Web
  • 27.
    How active iscommunity support for OData?
  • 28.
    Is it timeto rally around a standard like OData? Or is too early?
  • 29.
  • 30.
  • 31.
    THANK YOU Questions andideas to: groups.google.com/group/api-craft Anant Jhingran Brian Pagano Greg Brail @jhingran @brianpagano @gbrail

Editor's Notes

  • #2 Creative Commons Attribution-Share Alike 3.0 United States License