Выбираете OData или REST? Детальный анализ - PullRequest
0 голосов
/ 29 января 2020

Ниже представлен анализ с разных сайтов об Одате.

Справочная информация об Одатате

1. open standard and web protocol. protocol to expose data over the internet
2. developed by Microsoft, managed by Oasis Org
3. open data protocol - allow creation and consumption of query-able and inter-operable RESTFUL APIs
4. best way to REST
5. used by mobile and web app widely
6. all info about odata - odata.org
7. odata reference services - https://www.odata.org/odata-services/
8. querying and updating data
9. built on http and sends data using Json/Atom
10. support various advanced query language. example
    a. filtering and ordering data - http://../api/Orders?$filter=Total gt 1000$orderby=shippedat
       desc
    b. navigating through relationship - http://../api/Orders(451)/Lines(4)/Product/Name
    c. client side paging - http://../api/Orders?$top=10&$skip=10 and ~/Products/$skip=70&$top=10
11. Asynchronous queries
12. Odata protocol allows the publisher to tag and label the data with domain specific vocabularies.
13. Access data from any platform or device
14. OData shares some similarities with JDBC and with ODBC; like ODBC, OData is not limited to 
   relational databases.

Какую проблему решает Одата?

Data Api's frequently create more problem than solutions. many web-sites exposes data via apis
(ex: facebook, twitter)

Ex: facebook: what fields will i get when you read a post? time, user name
    twitter api: list of user's following me and unfollow someone (ex: post 
    https://api.twitter.com/1.1/friendships/destroy.json with id)

Usual problem: how to developers know ? they need to go through the documents. if API is changed, 
               then the request will be changed. uniformity increases the time needed to learn the 
               API. 

Reduces the amount of time to design an API.  

Остальные вопросы?

a. URL structure i.e how do you want your URL looks
b. search
c. how do you use the method consistenly 
d. how do you create a new resource

Разница между OData и REST

OData prescribes conventions that REST doesn't

   a. Representation formats
   b. Precise verb meaning
   c. URL conventions for filtering, paging etc.,

Другие различия

1. The problem is that ODBC allows clients to initiate transactions across multiple requests. REST 
   does not allow this as it would violate the stateless constraint. 
2. OData is a specific protocol where as REST is architecture style and design pattern
3. All OData is REST, but NOT all REST is OData.

Отрицательные или недостатки Odata

1. anti-pattern - provides both a weak contract and leaky abstraction. development and API practices 
   by providing a black-box framework to enforce a generic repository pattern.
2. An API should be designed with a specific intent in mind rather than providing a generic set of 
   methods that are automatically generated. OData tends to give rise to very noisy method outputs 
   with a metadata approach that feels more like a WSDL than REST. This doesn’t exactly foster 
   simplicity and usability.
3. allows remote clients to execute database queries remotely over HTTP which can only give rise to 
   complex and fragile integrations that break under the weight of edge case problems.
4. OData stems from an era (the 2000’s) where everything had to be XML (and SOAP ugh!). That era has 
   luckily passed and the open web has moved on to other simpler & more efficient formats & protocols 
   like JSON or protobuf etc.

Справочные ссылки

1. http://pragmatiqa.com/xodata/ for non-developer to play with Odata
2. https://www.odata.org/odata-services/ - Odata Services
3. https://en.wikipedia.org/wiki/Open_Data_Protocol

Что нужно?

  1. Ищете подробные отзывы / комментарии, чтобы узнать, стоит ли go с Odata v4 или выбрать REST. Некоторые говорят, что Odata устарела и не подходит для приложений нового поколения или следующего поколения. Не уверен.
  2. Образец рабочего приложения Odata и базы данных, с которыми можно поиграть или поработать, чтобы лучше понять Odata.
  3. Лучший способ быстрого обучения или ускорения работы с Odata.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...