Introducing the OData protocol

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Describe the OData standard for web-based applications

What is OData?

Open Data Protocol (OData) is an OASIS standard that defines the best practice for building and consuming RESTful APIs. OData helps you to focus on your business logic, while building RESTful APIs, without having to worry about the approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, and so on. It is an open standard that is defined by the OASIS consortium.

OData also guides you in tracking changes, defining functions or actions for reusable procedures, sending asynchronous or batch requests, and so on. Additionally, OData provides a facility for extension to fulfill any custom needs of your RESTful APIs.

OData RESTful APIs are easy to consume. The OData metadata, a machine-readable description of the data model of the APIs, enables the creation of powerful generic client proxies and tools. Some of these can help you interact with OData, even without knowing anything about the protocol.

OData Basics

OData Service

OData currently supports two formats for representing the resources it exposes:

  • The XML-based AtomPub
  • The JSON formats

JSON has significantly less protocol overhead than the Atom Publishing protocol. JSON can easily be consumed with JavaScript and by SAPUI5.

Each OData service is represented by a URI, called the service root URI. A URI (Uniform Resource Identifier) is a uniform resource identifier, which is a string of characters used to identify a resource. More precisely, each resource can be accessed using a URL (Uniform Resource Locator), a uniform resource locator, describing how to access the resource. This type of identification enables interaction with representations of the resource across a network using specific protocols like OData.

Types of Documents associated with each OData service

OData and CAP

In a CAP-based application, services are usually articulated through Core Data Services (CDS) models and are managed by the CAP runtime environment. In the CAP framework, every functional component is viewed as a service. These services represent the interactive characteristics of a domain, including the entities they expose, the actions they enable, and the events they trigger.

Note
While the default protocol for exposed services in CAP is OData, you can also make use of Protocol Adapters in CAP to overwrite the default behavior. Protocols such as REST and GraphQL are supported out-of-the-box. Additionally, it's also possible to define own Custom Protocol Adapters.

Summary

You now have a more profound understanding of the OData protocol and you can describe its key concept. You also learned about OData in CAP and have heard about the possibility to use different protocols through protocol adapters.

Log in to track your progress & complete quizzes