OData vs GraphQL [closed]

Is there a good comparison of GraphQL & OData in terms of performance, developers usability, community, etc.. All articles that I find in the Internet are very bias.

What would be the best way to return a big bulky JSON or binary data?


Solution 1:

I have researched and also tried with Both GraphQL in Dot Net and Odata in DotNet Web API to create a working demo and What I found are

  1. Developer Usability Considering you have existing WebAPI(DotNet Framework) and want to migrate to GraphQL or OData compatible WebAPI then my answer is to choose OData because of its easy integration and Out of the Box Filter, OrderBy, Select, Expand, etc feature (Refer MSFT On DotNet OData). If you choose GraphQL then you have to do a lot of work like Create Type, Schema and Query and Implement Resolver for each query.
  2. Performance depends on your query logic. GraphQL and Odata Both have the capability to get what you request using $select in OData and in GraphQL you can request by their Query convention.
  3. API Development From Scratch, If you want only single endpoint for all API request and don't want to maintain versioning endpoint, Autosuggest field name and type of schema then GraphQL is the best option. But Availability of GraphQL Library for Each framework and Community varies for Technology stack(e.g. nodejs, C#, Ruby, Java etc)

Yes, I have reviewed and read article by Telerik which have described in detail. Comparision PDF For GraphQL and Odata I am attaching side by side comparison image only you can dig out detail in Reference link GraphQL vs OData.

Standard API

Standard API

Here, No in API Versioning/ maintenance is positive meaning single endpoint and get rid of two versioned API

Query Capability

Query Capability

Surface Capability

Surface Capability

Mainly OData service is used when you want to provide access to your database with minimal effort for CRUD Operation.

However if you aware about Sharepoint REST API and Office 365 REST API It is based on OData and provides a wide range of API. Now Microsoft is building universal API which is called Graph API or Microsoft Graph which by default enabled for CORS request and unified endpoints to Request from Office 365, dynamics 365, Outlook Exchange API, Onedrive API etc. Which are also supports OData.

Solution 2:

It also does not seem like a good idea to use the POST method to request data. And apparently the amount of data needed to make a request to the server is much greater. According to examples from the Sumit Sarkar article:

Example for OData

Example for GraphQL

The amount of data trafficked to make a request is much greater in GraphQL than in OData. Although, the result (response) is the same.