REST API
From Roy Fielding's constraints to everyday practice: how to design consistent, predictable REST APIs with the right URLs, methods, pagination, and status codes.

API Technologies in Modern Backend Systems
In modern backend systems, APIs are used for communication between different parts of the system, such as frontend and backend, microservices, and other systems.
APIs can be implemented using different technologies, depending on the requirements and the team's preferences.
Some common API technologies include:
REST: The default style for public and general-purpose APIs, using HTTP methods and resource URLs.
GraphQL: Clients request exactly the fields they need from a single endpoint. Common in frontend-heavy products.
gRPC: A high-performance RPC framework using Protocol Buffers and HTTP/2. Widely used for internal microservice communication.
WebSockets: A persistent, two-way connection for real-time features such as chat, notifications, and multiplayer apps.
Server-Sent Events (SSE): A one-way stream from server to client over HTTP. Commonly used for streaming LLM/AI responses.
tRPC: Lets TypeScript clients call server functions directly with end-to-end type safety. Popular in full-stack TypeScript projects.
Webhooks: The server sends an HTTP request to a registered URL when an event occurs. Standard for third-party event notifications (for example, Stripe, GitHub).
Kafka / RabbitMQ: Message queues and event streaming for asynchronous, event-driven backend systems.
The most commonly used API technologies are REST and GraphQL.
Advantage of standardized API design is it reduces confusion and trial and error when learning how to use a server's API.
REST API Standardization
REST is a set of architectural constraints and design principles for creating web services.
It is a widely adopted standard for building APIs and the most commonly used API technology in modern backend systems.
Applying these standards removes ambiguity and inconsistencies in API design, making APIs easier to build and maintain.
History of REST
In 1989–1990, Tim Berners-Lee started the "World Wide Web" project to share information and resources on the internet.
Within a year or two, he created technologies such as:
URIs (Uniform Resource Identifiers) to identify resources on the web.
HTTP (Hypertext Transfer Protocol) to send requests and receive responses.
HTML (Hypertext Markup Language) to structure the content of web pages.
Web servers to serve the content.
Web browsers to access the content.
WYSIWYG (What You See Is What You Get) editors to create and edit web pages.
Most of these technologies are still in use today.
As the number of users grew enormously, the WWW was at risk of breaking under the scale, so its architecture needed to be formalized.
Roy Fielding, a co-founder of the Apache HTTP Server, worked on the HTTP and URI specifications and defined a set of architectural constraints for web services in his 2000 doctoral dissertation, which introduced REST (Representational State Transfer).
Principles of REST:
Client-server separation
Uniform interface, which makes component communication easy
Layered system
Cacheable responses
Statelessness
Code on demand (optional)
REST
Representational: Resources are represented in a specific format, such as JSON or XML, based on what the client requests.
State: The current condition of a resource in the system, which can be shared between server and client.
Transfer: The movement of a resource's representation from one system to another.
Parts of a URL
Above is the typical URL structure for a REST API.
Syntax:
scheme://domain[:port]/path-to-resource?query-string#fragmentScheme: The protocol used to access the resource, such as
http,https, orftp.Domain: The domain name of the server, such as
www.example.com, which maps to an IP address and port, or the IP address and port can be used directly.Path: The resource path, in a hierarchical structure separated by slashes.
Query: A string of key-value pairs appended to the URL after a question mark (
?).Fragment: A string appended to the URL after a hash (
#), which points to a specific section of the page.
The industry standard for REST API URLs is
scheme://api.domain.com/version/name-of-resource?query-string#fragment.Rules for creating API URLs:
Use plural nouns for resource names, such as
usersinstead ofuser.Keep the plural form even when accessing a single resource, such as
/users/1.Don't use spaces in the URL. When creating a slug, use hyphens instead of spaces.
Make the URL readable, easy to remember, and lowercase.
Idempotency
Idempotency means that calling an API multiple times with the same input has the same effect on the system as calling it once.
For example, fetching the user with id 1 returns the same user object every time it is called with the same id, or an error/null if the user doesn't exist.
Idempotent methods:
GET: Returns the same result when called again with the same parameters.
PUT: Overwrites the same resource with the same values.
Patch: Updates the resource with the same values.
DELETE: Deletes the resource; repeating the call leaves the system in the same state.
Non-idempotent methods:
- POST: Creates a new resource each time it is called.
PUT vs PATCH
PUT updates a resource by replacing the entire resource with the new one.
PATCH updates only the properties passed in the request body.
When an API is used by multiple clients, use PATCH cautiously to avoid conflicts.
Non-CRUD APIs
When an API is not performing any create, read, update, or delete operations, it is called a non-CRUD API. These non-CRUD task are called actions
All the non-CRUD APIs are sent with HTTP verb
POSTExample of non-CRUD APIs: sending a message in chat application or sending an email where server checks who is the user sending and receiving the email, validate the details and send the email
API Design Workflow
Create a UI prototype and wire-frames. They show how users will interact with the system and what data to expect from them. They also let the frontend and backend be built together, and the database models can be formed and locked down.
Use the entities from the UI prototype and wire-frames to create the database schema.
Identify the actions and their flows, and create an API endpoint for each action.
Use an API tool like Postman to create mock API endpoints. In the mocks, decide the method, URL, path, parameters, headers, request and response bodies, and the success and error codes.
Pagination and filtering
Define a pagination and filtering strategy for endpoints that return a list of data.
Pagination and filtering improve API performance in terms of response time and data transfer.
Accept the following parameters in the request to control pagination and filtering:
page: current page number (default: 1)pageLimit: number of items per page (default: 10)sortBy: field name to sort by (default:createdAt)sortOrder: ascending or descending order (default: ascending)filterField: field name to filter by (default: none)filterValue: value to filter by (default: none)
Add pagination and filtering properties to the response schema, such as:
page: current page numberpageSize: number of items per pagetotalCount: total number of itemstotalPages: total number of pagessortBy: field name sorted bysortOrder: ascending or descending order
CRUD on a resource using a single endpoint
When creating endpoints for CRUD operations on a single resource, use the same endpoint path for all operations and differentiate them by HTTP method:
GET
baseUrl/v1/resources/{id}: Retrieves the resource with the specified ID.POST
baseUrl/v1/resources: Creates a new resource.PUT
baseUrl/v1/resources/{id}: Replaces the resource with the specified ID.PATCH
baseUrl/v1/resources/{id}: Partially updates the resource with the specified ID.DELETE
baseUrl/v1/resources/{id}: Deletes the resource with the specified ID.DELETE
baseUrl/v1/resources: Deletes all resources.
For action endpoints, use
POSTand follow the same API standards as other REST calls.
Choose the right HTTP response code.
Status codes are grouped by class:
1xx(informational): the request was received and the server is continuing to process it.2xx(success): the request was processed successfully.3xx(redirection): the client must take further action.4xx(client error): the request is invalid.5xx(server error): the server failed to process a valid request.
Best Practices for Building REST APIs
Use exactly the same field names for the same resource's fields in all request and response payloads.
Use plural names for resources.
Use the right HTTP method for each operation and the correct status code for each response.
Use interactive API documentation built with tools like Swagger.
Make the API intuitive, consistent, and easy to use.
Provide default values for optional parameters.
Avoid abbreviations.
Use nouns, not verbs, in resource URLs; the HTTP method describes the action.
Version the API in the URL, such as
/v1/resources.Return errors in a consistent format across all endpoints.
Use HTTPS for all endpoints.
About the author
- My journey started as a Computer Engineering student with a deep curiosity about how software systems are built from the ground up. During college, I dove into web development, databases, and machine learning — shaping a strong foundation in problem-solving and software engineering. I graduated with a Grade A+ and went on to publish research on a KNN-based recommendation system I built as part of my final-year project. After college, I started out building UI dashboards integrated with Microsoft Dynamics 365, improving data visualization by 40% and cutting decision-making time by 25%. I then grew into a Full Stack role — developing a payment gateway serving 66 million users with 125,000 daily transactions, and a real-time analytics dashboard powered by Apache Kafka and Pinot that reduced query latency by 76%. Outside of work, I enjoy building personal projects — from a neighbourhood e-commerce platform to a URL shortener and a video streaming service. I'm driven by clean architecture, real-world performance, and the satisfaction of shipping systems that actually work under pressure.
Comments
Join the discussionNo comments yet. Be the first to comment.
First Principles of Backend Engineering
An in-depth article series deconstructing the core mechanics of backend systems. Moving beyond frameworks and trendy tools, this series explores the fundamental building blocks of the web—from network protocols and reverse proxies to database architecture and server security—helping you understand exactly how and why scalable systems work from the ground up.





