# GraphQL

## Introduction

* It is a solution that provide flexibility on response data format from server
* The data format is defined from client side

## Flow

* Here is the format of query

![](https://1374779285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFW3x2aqEO8GF2kr3VU%2Fuploads%2FIhHabpZ2huoVoOZ8ymHv%2Fscreenshot-www.udemy.com-2022.11.15-10_42_50.png?alt=media\&token=05ffba56-8f09-49a2-8207-36a230031b37)

* Include operation type and request fields

![](https://1374779285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFW3x2aqEO8GF2kr3VU%2Fuploads%2FzsQ37f65hVnLIpyBbBGq%2Fscreenshot-www.udemy.com-2022.11.15-10_22_51.png?alt=media\&token=67c891b5-c6a3-40c6-90ef-afd505913222)

* The client will send request on one single API end point with query definition
* The server will implement the logic based the operation type and definition
* The data with specific format will be sent back to client

## Operation Types

* There are 3 types - Query, Mutation, Subscription

![](https://1374779285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFW3x2aqEO8GF2kr3VU%2Fuploads%2F1FUuU3ybYFZzAtWogLu2%2Fscreenshot-www.youtube.com-2022.11.15-10_44_31.png?alt=media\&token=5199c9a8-81d3-4f70-822c-8bb1a6e3ae07)

![](https://1374779285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFW3x2aqEO8GF2kr3VU%2Fuploads%2Ff1l7LJnY3Bc4eKz3HP6l%2Fscreenshot-www.youtube.com-2022.11.15-10_48_06.png?alt=media\&token=bb33b17d-efdd-404a-991c-9d7da4fd8533)

### Query

* Acts like get method of API to fetch the data

### Mutation

* Acts like post, put, delete method of API to modify the data

### Subscription

* &#x20;The server will active push message to client subscribed



