0% found this document useful (0 votes)
8 views3 pages

Rest

A RESTful API is an architectural style that uses standard HTTP methods for CRUD operations on resources identified by URIs. Key principles include statelessness, client-server architecture, and a uniform interface, making it simple and scalable. REST is widely adopted for its ease of use and compatibility with web technologies.

Uploaded by

dogan.jonat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Rest

A RESTful API is an architectural style that uses standard HTTP methods for CRUD operations on resources identified by URIs. Key principles include statelessness, client-server architecture, and a uniform interface, making it simple and scalable. REST is widely adopted for its ease of use and compatibility with web technologies.

Uploaded by

dogan.jonat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

RESTful APIs – In-Depth Summary

REST (Representational State Transfer) is an architectural style for designing networked


applications, especially web services. A RESTful API uses standard HTTP methods to perform
CRUD operations (Create, Read, Update, Delete) on resources, making it simple, scalable, and
stateless.

🌐 What Is a RESTful API?


A RESTful API exposes resources (data objects) via URLs and uses HTTP methods to
operate on them. The key idea is to treat everything as a resource, and each resource is
identified by a URI (Uniform Resource Identifier).

For example:

sql
CopyEdit
GET /users → Get all users
GET /users/1 → Get user with ID 1
POST /users → Create a new user
PUT /users/1 → Update user with ID 1
DELETE /users/1 → Delete user with ID 1

🔑 Key Principles of REST


1.​ Statelessness​
Each request from the client contains all the information needed to process it. The
server does not store any session state.​

2.​ Client-Server Architecture​


The client and server are separate entities that interact over a well-defined interface
(usually HTTP). This separation allows independent evolution.​

3.​ Uniform Interface​


REST uses standard HTTP methods (GET, POST, PUT, DELETE) and status codes
(200, 201, 404, etc.).​
4.​ Resource-Based​
Resources are identified by URIs and typically returned in formats like JSON or XML.​

5.​ Cacheability​
Responses must define whether they can be cached to improve performance.​

6.​ Layered System​


A RESTful system may be composed of multiple layers (e.g., API gateway,
authentication layer) without affecting the client-server interaction.​

📦 Common HTTP Methods


Method Purpose

GET Read data

POST Create new data

PUT Update existing data (full update)

PATCH Update part of the data

DELETE Remove data

🛠️ Designing a RESTful API (Best Practices)


●​ Use nouns in URIs, not verbs (/products, not /getProducts)​

●​ Return proper HTTP status codes​

●​ Keep it stateless​

●​ Support filtering, pagination, and sorting​

●​ Use versioning (/api/v1/products)​

●​ Secure with HTTPS, authentication, and rate limiting​


🔍 Status Codes to Know
Code Meaning

200 OK

201 Created

204 No Content (delete


success)

400 Bad Request

401 Unauthorized

403 Forbidden

404 Not Found

500 Internal Server Error

🧠 Summary
●​ A RESTful API follows REST principles and uses HTTP methods to interact with
resources.​

●​ It is stateless, cacheable, and designed around clear, resource-oriented URIs.​

●​ REST is widely used due to its simplicity, scalability, and compatibility with the web.

You might also like