DEV Community

Anushka Shinde
Anushka Shinde

Posted on

I Learned REST APIs in College - But Nobody Told Me What They Actually Do

You open Instagram.Your feed loads. You like a post. You follow someone.Every single one of those actions is a REST API call happening behind the screen.

College taught me GET, POST, PUT, DELETE, status codes, endpoints, JSON.I memorized it. Answered exam questions about it.

Then I sat down to build a real project and had no idea how any of it actually connected.

Here's where every REST API concept actually lives in the real world.
Real example first, then the concept, then where to use it.


πŸ“± You open Instagram. Your feed loads with posts.

Concept: GET Request

GET is used to fetch data. Nothing changes. Nothing is created.You are just asking give me this data.

When Instagram loads your feed your app sends a GET request to Instagram's server.Server finds your posts. Returns them.
Your screen displays them.

No data was changed. Just fetched.

Use it when: Loading any page, fetching any list, getting any details user profile, product list, order history, search results.


✍️ You post a new photo on Instagram.

Concept: POST Request

POST is used to create something new.You are sending data to the server save this.

When you post a photo your app sends a POST request with the image and caption.Server saves it to the database.It now exists for everyone to see.

Use it when: User registration, placing an order, submitting a form,adding a product, posting a comment anything that creates new data.


✏️ You edit your Instagram bio.

Concept: PUT and PATCH Request

PUT replaces the entire resource.
PATCH updates only specific fields.

When you edit your bio only the bio field changes.Your name, profile picture, followers untouched. That's PATCH - update only what changed.

PUT would replace your entire profile with the new data.

Use it when:
PUT - replacing an entire record like updating a full user profile.
PATCH - updating one specific field like changing a password or email.


πŸ—‘οΈ You delete a comment on Instagram.

Concept: DELETE Request

DELETE removes something from the server.

When you delete a comment your app sends a DELETE request with the comment ID.Server finds it. Removes it. Gone.

Use it when: Removing any data deleting an account,
cancelling an order, removing a product, clearing a notification.


πŸ”— Instagram has separate addresses for posts, users, stories, and reels.

Concept: Endpoints

An endpoint is the specific address of a resource on the server.

Every type of data has its own address:
/users β€” for user data
/posts β€” for post data
/stories β€” for stories
/reels β€” for reels

Clean, specific, predictable addresses.
Each endpoint does one thing for one resource.

Use it when: Designing your project's API β€”every entity gets its own endpoint./donors, /hospitals, /inventory in a blood bank system./products, /orders, /users in an e-commerce system.


βœ… You place an order on Swiggy. Something comes back confirming it worked.

Concept: HTTP Status Codes

Every API response comes with a status code telling you what happened.

200 β€” Success. Here's your data.
201 β€” Created. Your new resource was saved.
400 β€” Bad Request. You sent something wrong.
401 β€” Unauthorized. You're not logged in.
403 β€” Forbidden. You don't have permission.
404 β€” Not Found. That resource doesn't exist.
500 β€” Server Error. Something broke on our end.

When your Swiggy order confirms the server returns 201 Created.
When you search a restaurant that doesn't exist server returns 404 Not Found.

Use it when: Every API response in your project should return the correct status code not just 200 for everything.


πŸ“¦ Instagram sends your feed data in a structured format your app can read.

Concept: JSON Response

REST APIs communicate using JSON JavaScript Object Notation.

It's just structured data.Key value pairs.Your app reads it and displays it.

Every API response user details, product info, order status comes back as JSON that your frontend parses and renders.

Use it when: Every API response in your project returns JSON.Spring Boot does this automatically.React reads it and updates the UI.


πŸ” You can see your own Zomato orders. You cannot see someone else's.

Concept: Authentication and Authorization in APIs

Authentication β€” who are you?
Authorization β€” what are you allowed to do?

When you call /orders on Zomato the API checks your token first.
Are you logged in? That's authentication.Are these your orders? That's authorization.

Without a valid token β€” 401 Unauthorized.Trying to access someone else's orders β€” 403 Forbidden.

Use it when: Any API that returns personal or sensitive data needs authentication user profiles, order history, payment info.


πŸ“Š The Honest Summary

Real World Scenario REST API Concept
Feed loads on Instagram GET Request
You post a new photo POST Request
You edit your bio PATCH Request
You delete a comment DELETE Request
/users /posts /orders addresses Endpoints
Order confirmed β€” 201 Created Status Codes
Data returned in structured format JSON Response
Only you can see your orders Authentication and Authorization

Final Thought

Every app you use daily is a collection of API calls.

Open Instagram β€” GET.
Post a photo β€” POST.
Edit profile β€” PATCH.
Delete comment β€” DELETE.

REST APIs are not a backend concept.They are the language your frontend and backend
use to talk to each other.

Once you see every user action as an API call building full stack applications starts to make complete sense. 😊


Which REST API concept finally clicked for you when you used it in a real project?

Drop it below πŸ‘‡

Top comments (0)