Introduction
REST is a style for designing web APIs that use HTTP methods and URLs. You’ll see it everywhere: public APIs, internal services, and mobile backends. Here we'll stick to the core ideas and how to use them in practice. REST isn't a standard but a set of constraints and conventions that, when followed, make APIs predictable and easy to consume. Nail those and your APIs play nicely with clients, caches, and tooling.

What Is REST API Basics
REST (Representational State Transfer) is an architectural style, not a protocol. APIs that follow it use HTTP verbs (GET, POST, PUT, PATCH, DELETE) to act on resources identified by URLs. GET reads, POST creates, PUT/PATCH update, DELETE removes. Data is usually exchanged as JSON. Stateless means each request carries enough context; the server doesn’t rely on session state stored between requests. Resources are identified by URIs; the same URI should return the same representation unless the resource changes. REST does not prescribe a specific data format, but JSON is the most common for request and response bodies. HATEOAS (Hypermedia as the Engine of Application State) is sometimes mentioned: the idea that responses include links to related resources so the client can discover the API. In practice, many REST APIs rely on documentation or OpenAPI rather than full HATEOAS.
Why It Matters
REST gives a consistent, predictable way to expose and consume APIs. Clients can cache GET responses, use standard HTTP status codes, and integrate with existing tooling (proxies, auth, load balancers). Understanding REST helps you design clear APIs and debug requests and responses.
How to Calculate It
Real-Life Example
A blog API: GET /posts returns a list. GET /posts/1 returns one post. POST /posts with a JSON body creates a post and returns 201 with the new resource. PATCH /posts/1 updates that post. DELETE /posts/1 removes it. The client uses the same base URL and different methods and paths; the server returns JSON and appropriate status codes.
Common Mistakes
Using GET for actions that change data. Using POST for everything instead of PUT/PATCH/DELETE where appropriate. Ignoring status codes and only checking the body. Not using idempotency for retries (e.g. PUT instead of POST for updates). Exposing internal IDs or implementation details in URLs. Forgetting to set Content-Type (e.g. application/json) on requests with a body. Returning HTML error pages for API endpoints instead of JSON with a proper 4xx/5xx code makes it harder for clients to handle errors programmatically.
Practical Tips
- Use nouns for resources (e.g. /users), not verbs (e.g. /getUsers).
- Return the right status codes: 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Server Error.
- Document your API (OpenAPI/Swagger) and stick to it.
- Version the API in the URL or header if you need backward compatibility.
- Use consistent error response shape (e.g. { code, message, details }).
FAQs
Conclusion
REST gives you a clear, HTTP-native way to design and use APIs. Nail the methods and status codes, keep resources and URLs consistent, and document your contract—then go test with real clients and tools. That’s the recipe.