Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.5 KB

4.rest-api-graphql-wshp.md

File metadata and controls

35 lines (28 loc) · 1.5 KB

REST API and GraphQL - An Overview

We discussed the REST API, GraphQL, and their usage. A recording of the session demonstrations is available here.

REST API

Representational State Transfer is a software architectural style that defines a set of constraints to be used for creating Web services.

It is abundantly used in web applications for data retrieval, insertion, manipulation, and deletion.

Below are the 4 request-types we discussed:

  1. GET
    • Used to retrieve data.
    • The request body doesn't have significance, but the endpoint does.
  2. POST
    • Used to insert data.
    • Both request body and the endpoint are significant.
  3. PUT
    • Used to update data.
    • Both request body and the endpoint are significant.
  4. DELETE
    • Used to delete data.
    • The request body doesn't have significance, but the endpoint does.

GraphQL

The limitations of the REST API are:

  • We are victim to overfetching. We can't selectively choose which properties to retrieve, unless we are using extensive non-standard techniques.
  • GET and DELETE requests don't use any data provided in the request body.

To overcome these, and possibly several other limitations, GraphQL was born.

Exercises

Use the below-mentioned tools to try out the REST API and GraphQL:

Made with ❤ by Param.