Need advice about which tool to choose?Ask the StackShare community!
GraphQL vs OData: What are the differences?
GraphQL: A data query language and runtime. GraphQL is a data query language and runtime designed and used at Facebook to request and deliver data to mobile and web apps since 2012; OData: *A REST-based protocol for querying and updating data *. It is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. It helps you focus on your business logic while building RESTful APIs without having to worry about the various approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc.
GraphQL and OData can be categorized as "Query Languages" tools.
GraphQL is an open source tool with 11.8K GitHub stars and 769 GitHub forks. Here's a link to GraphQL's open source repository on GitHub.
Pros of GraphQL
- Schemas defined by the requests made by the user74
- Will replace RESTful interfaces62
- The future of API's60
- The future of databases48
- Self-documenting12
- Get many resources in a single request11
- Query Language5
- Ask for what you need, get exactly that5
- Fetch different resources in one request3
- Evolve your API without versions3
- Type system3
- Easy setup2
- GraphiQL2
- Ease of client creation2
- Good for apps that query at build time. (SSR/Gatsby)1
- Backed by Facebook1
- Easy to learn1
- "Open" document1
- Better versioning1
- Standard1
- 1. Describe your data1
- Fast prototyping1
Pros of OData
- Patterns for paging, sorting, filtering7
- ISO Standard5
- RESTful3
- Query Language3
- No overfetching, no underfetching3
- Batch requests2
- Get many resources in a single request2
- Ask for what you need, get exactly that2
- Self-documenting2
- Bulk requests ("array upsert")2
- Resource Modification Language1
- Resource model defines conventional operations1
- Evolve your API by following the compatibility rules1
Sign up to add or upvote prosMake informed product decisions
Cons of GraphQL
- Hard to migrate from GraphQL to another technology4
- More code to type.4
- Takes longer to build compared to schemaless.2
- All the pros sound like NFT pitches1
- Works just like any other API at runtime1
Cons of OData
- Overwhelming, no "baby steps" documentation1