codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

Member-only story

Understanding GraphQL vs REST!

Saiteja Kura
codeburst
Published in
6 min readJun 30, 2020

Designed using Canva.

Imagine that I’m a customer requesting that a supplier sends me a quantity of item X and a quantity of item Y to my nearby post office. Annoyingly, my supplier sends two separate couriers to me on two separate days so now I have to go to the post office twice to pick the orders. Why not have a single package containing both the items delivered at once? Keep this in mind for now.

Before we dive into the main topic, here are some key terms to be familiar with:

API — Suppose you want to receive tweets from Twitter containing the tag #pandemic. How would you go about this? You can send an email to twitter requesting tweets in the form of a spreadsheet. Then, you can import these tweets into your application. But your data quickly gets outdated and needs constant importing. This is where an API comes into the picture. Twitter created an API where we can query data based on requirements. So basically API acts as a broker by providing access to another application’s data. Check this link out to learn more.

Client — A client can be our web browser or mobile app requesting data from an API. For instance, when we search for a user name in Instagram’s search box by logging in to our app, our app acts as the client here.

Resource — A resource can be any object an API is providing. For instance, on Instagram, a client searches for a user’s photo or a hashtag. Here the user’s photo and a hashtag ARE THE resources.

Now, what is REST?

REST is an architectural concept for network and client-server based software. REST stands for Representational State Transfer. A RESTful API exposes its data to clients in the form of resources. It also enables the clients to perform actions on those resources like creating a resource(POST), editing a resource(PUT), retrieving a resource(GET), and deleting a resource(DELETE). Representational State Transfer implies the server will send the representation of the state of the requested resource to the client.

For Example, in Instagram API when the client requests a user profile, the user’s posts, comments, and bio at that current time are…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Written by Saiteja Kura

Software Engineer who loves building real-time applications and exploring new technologies.

No responses yet

Write a response