Menu

1 / 2

๐Ÿ“ฎ REST API Explained Like You're 5

DEV CommunityยทSreekar Reddyยท6 months ago
#QmOnKjZM
#eli5#web#api#beginners#users
Reading 0:00
15s threshold

Web services using HTTP verbs

Day 128 of 149

๐Ÿ‘‰ Full deep-dive with code examples

The Library Analogy

A library with standard commands:

GET a book - Receive book

POST a book - Donate new book

PUT a book - Replace with updated version

DELETE a book - Remove from library

REST APIs use the same HTTP verbs to operate on resources.

HTTP Methods = CRUD

Method Action Example

GET Read GET /users

POST Create POST /users

PUT Update PUT /users/1

DELETE Delete DELETE /users/1

Real Example

// Get all users const users = await fetch ( " /api/users " );

// Create user await fetch ( " /api/users " , { method : " POST " , body : JSON .โ€ฆ

Continue reading โ€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.