REST API
api web backend http
What is REST API?
A REST API is a way for computer programs to talk to each other over the internet using simple, standard methods. REST stands for “Representational State Transfer,” which means it transfers representations (usually JSON or XML) of the state of resources (like users, products, or articles).
It lets one program ask another program for information or send information, using simple commands like “get this” or “send that.”
Simple Analogy
Think of a REST API like a library system:
Each book has a unique address on a shelf (URL for a resource) and there are standard ways to interact with books:
- Checking the catalog (GET - retrieve information)
- Adding a new book to the collection (POST - create)
- Replacing or editing a damaged book with a new copy (PUT - update)
- Removing an outdated book (DELETE - remove)
You don’t need to know how the library organizes things internally, anyone who understands libraries can use any library, even in different cities
Key Concepts
- Resources: Things you can access via URLs (e.g.,
/users
,/products/123
) - HTTP Methods: Standard operations on resources
- GET: Get information
- POST: Create something new
- PUT/PATCH: Update something
- DELETE: Remove something
- Stateless: Each request contains all information needed, so the server don’t have to remember previous requests
- Representation: Resources can be shown in different formats (JSON, XML, etc.)
- Status Codes: Standard responses indicating success or failure (200 OK, 404 Not Found, etc.)