2

The OData specification is long. Even the "OData Core" document is pretty long.

So, how about a condensed summary of what a read-only OData publisher needs to implement at a minimum?

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219

1 Answers1

6

I'll start. An OData service provides an HTTP endpoint that:

  • MUST understand "Accept" headers
  • MUST support Content-Type header, and MUST support ATOM format (optionally JSON)
  • MAY return a service document (list of collections) to GET / (10.1.1)
    • If ATOM (AtomPub?) format, the hierarchy is service/workspace/collection/title
  • MUST return descriptions of collections to requests like GET /Customers (10.2)
    • If ATOM, the hierarchy is feed/entry/content
  • MUST return descriptions of individual entities to requests like GET /Customers(3) (10.2.1)
  • MAY return individual properties of individual entities for requests like GET /Customers(3)/Name (10.2.2)
  • MUST make available a CSDL schema description wrapped in an EDMX document (10.1.2)
    • This SHOULD be available at /$metadata
  • MAY support any of these queries (10.2.3)
    • Filters (limit rows returned): Products?$filter=Price lt 10.00
    • Select (limit fields returned): Products?$select=Rating,ReleaseDate
    • Order-by: Products?$orderby=ReleaseDate asc, Rating desc
    • Top, skip: Products?$top=5&$skip=2
    • InlineCount (include an entity count): Products?$inlinecount=allpages
  • MUST (?) provide a list of relationships for an entity (10.2.4): Products(0)/$links/Orders
  • MUST provide an entity count (10.2.5): Products/$count
  • MAY support other formats with $format specifier (10.2.3.7)

When an ATOM feed is returned (such as for a collection), it needs to conform to some OData conventions: http://www.odata.org/documentation/odata-v3-documentation/atom-format/ For example:

  • Types used are "edm:String" etc.
  • link elements are used generously
  • content elements either contain content inline (eg, text data), or link to it (eg, images, binary files) with src= attribute.

When a JSON feed is returned, it similarly follows certain rules:

URLs are encouraged to follow this scheme:

nforss
  • 1,258
  • 1
  • 17
  • 31
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
  • URLs are not required to follow the conventions. It is perfectly valid to have an OData service which doesn't use parenthesis for key lookups, but instead uses some other form). – Vitek Karas MSFT Jul 26 '12 at 09:35
  • This is a good summary. Where can I understand more about what relationships according to the OData standard and what different endpoints should an implementation support in order to adhere to the standard (version 4.0)? – Andy Dufresne Aug 05 '20 at 08:39