What is OData and what is it for?

I've been hanging out with some people talking about OData, I did some research I saw some codes, but it was not clear to me some things, among them:

  • What is OData for?
  • What are the advantages and disadvantages?
  • when to use OData?
  • when not to use OData?
Author: Barbetta, 2018-03-17

1 answers

OData (Open Data Protocol) defines a set of best practices for creating and consuming RESTful APIs. OData helps you focus on your logic when creating RESTful APIs without having to worry about the various approaches to defining request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc.

The exponential growth of SaaS applications led a burst of Rest APIs . This means that a developer will spend most of their time learning new APIs instead of building their own application. To solve this problem, Microsoft created the OData standard to create Rest APIs .

What is OData for?

The protocol allows the creation and consumption of REST APIs , which allow Web clients to publish and edit resources using URLs and defined in a data, using simple HTTP messages. Supports HTTP, Atom Pub and JSON formats.

What are the advantages and disadvantages?

advantages:

  • has support for any type of data source, even a custom class of its own.
  • there is no need to create a proxy service object. So, it is light to use.
  • you can create your own custom methods and expose them.
  • as it is lightweight, the interaction between server and client is fast. Thus, it presents a good performance.
  • Fully supports CRUD using the different HTTP methods:

    • GET: gets one or more entries.
    • POST: creates a new entry.
    • PUT: updates an existing entry.
    • DELETE: removes an entry.

disadvantages:

  • since it is purely URL-based, it is less safe.
  • not every query operator in LINQ is available in OData, such as filter, skip, Take etc.

When to use OData?

As the explosion of APIs continues, each organization exposes its own Rest APIs/SOAP/Bulk exclusive for the consumption of your data. And some of them also create their own unique query languages, such as ROQL (Oracle Service Cloud), SOQL (Salesforce ), etc. This makes it difficult for a company and its development team to learn and program against all of these features, with different APIs.

Is where OData is very useful. OData advocates a standard way to implement REST APIs that allows SQL-like query capabilities using these RESTful APIs. OData is essentially SQL for the Web built on the standard protocols-HTTP, JSON and ATOM - while taking advantage of the REST architecture style.

When not to use OData?

Note the items in disadvantages listed in the topic " What are the advantages and disadvantages?".


references:

 15
Author: Sam, 2019-04-23 18:37:03