What is OData for?

14

I've gotten caught up with some people talking about OData , I did some research I saw some codes, but I was not clear about some things,

  • What is OData for?
  • What are the advantages and disadvantages?
  • When to use OData?
  • When not to use OData?
asked by anonymous 17.03.2018 / 19:59

1 answer

13

The Open Data Protocol (OData) defines a set of best practices for creating and consuming RESTful APIs . OData helps you focus on your logic by creating RESTful APIs without you need to be concerned with 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 has led to an explosion of REST APIs . This means that a developer will spend most of the time learning new APIs rather than creating the application itself. To resolve this problem, Microsoft has 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 features using URLs and defined in a data model using simple HTTP messages. It supports HTTP, Atom Pub and JSON.

  

What are the advantages and disadvantages?

Advantages:

  • Supports any type of data source, even a custom class of its own.
  • There is no need to create a proxy service object. So it's lightweight to use.
  • You can create your own custom methods and expose them.
  • As it is light, the interaction between server and client is fast. So it performs well.
  • Provides full support for CRUD using the different HTTP methods:

- GET: obtém uma ou várias entradas. - POST: cria uma nova entrada. - PUT: atualiza uma entrada existente. - DELETE: remove uma entrada.

Disadvantages:

  • Because it is purely URL-based, it is less secure.
  • Not every query operator in the LINQ is available in OData, such as filter , < em> skip , take etc.
  

When to use OData?

As the explosion of APIs continues, each organization exposes your own REST APIs / SOAP / Bulk only for 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 for all of these features with different APIs.

This is where OData is very useful. OData advocates a standard way to implement REST APIs that allows query resources similar to SQL using these RESTful APIs . OData is essentially the SQL for the Web created over the standard protocols - HTTP, JSON and ATOM - while taking advantage of the style REST architecture.

  

When not to use OData?

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

References:

30.03.2018 / 06:26