1. What is GraphQL?

GraphQL is an open-source data query manipulation language intended for developing APIs.

- Provides an easy-to-understand data structure.

- Determine what you need or no need when you request.

- With many developer tools and easier upgrades in the future.


2. Major advantages of GraphQL

- One of the best solutions for microservices and complex systems.

- Using Hierarchical Structure.

- Way faster than other communication APIs.

- Easy to learn, use, and explore an API quickly.

- It only has a single endpoint.

- Fetching only the exact and specific data in a single request.


3. Language support

GraphQL supports many popular current programming languages such as:

  • JavaScript
  • Python
  • C# / .NET
  • Go
  • PHP
  • Ruby
  • Java / Kotlin
  • Rust
  • Swift / Objective-C
  • Elixir
  • Scala
  • Flutter


4. Some compare between GraphQL and Rest API

Data access

  • Rest API: multiple endpoints.
  • GraphQL: has a single URL endpoint.

Response data

  • Rest API: the server fixes the Rest API structure response data.
  • GraphQL: the client fixes GraphQL structure response data.

Best suited

  • Rest API: suitable with simple data sources where resources are well-defined.
  • GraphQL: suitable with large, complex, and interrelated data sources.

Validate error

  • Rest API: check and return in client if the returned data is valid.
  • GraphQL: the schema structure will reject the invalid data.


Here’s an example of how a REST API and a GraphQL API would handle a request for a user’s name, email, and phone number:

Rest API


GET api/informations/13
 "name": "Thormetal",
 "email": "thormetal@ivc.com", 
 "phone": "xxx-xxx-xx90",
 "infor": {
   "street": "123 Cong Hoa",
   "city": "HCM",
   "company": "ISB",
   "section": "Sec 6"
GET api/graphql
query {
 information(id: 13) { 


In the below example, I just want to get information on name, email, and phone number.

- The REST API returns a fixed data structure that includes: name, email, phone number, and many other information.

- The GraphQL API, on the other hand, allows you to specify exactly what data you need, so it will return the correct data you.

specified (name, email, phone)


[Reference Source]

  • https://graphql.org/
  • https://medium.com/swlh/a-quick-intro-to-graphql-1c6e651562c8
  • https://www.javatpoint.com/graphql-advantages-and-disadvantages
  • https://aws.amazon.com/compare/the-difference-between-graphql-and-rest
  • https://dev.to/callebdev/understanding-graphql-and-its-design-principles-fd6

Leave a comment