All guides
Home Glossary REST API
Term

REST API

REST API is an architectural style for distributed systems that uses the HTTP protocol to manage and interact with resources.

REST API (Representational State Transfer Application Programming Interface) is an architectural style for distributed systems that uses the HTTP protocol to manage and interact with resources. It treats every entity—such as a user, server instance, or file—as a distinct resource accessible via a unique URL, exchanging data primarily in JSON or XML formats. Because it relies on standard web infrastructure, REST remains the foundational choice for cloud integrations, microservices, and public-facing web services.

How it works

REST operates on a strict client-server separation and a stateless communication model. Each HTTP request from a client must contain all the information the server needs to understand and process it, including authentication tokens and query parameters. The server does not store session state between calls, allowing load balancers to route incoming traffic to any available backend node without sticky sessions.

Actions are mapped directly to standard HTTP methods, while responses use standard HTTP status codes (such as 200 OK, 201 Created, or 404 Not Found) to indicate outcomes:

  • GET retrieves a representation of a resource without modifying it;
  • POST creates a new subordinate resource or triggers a processing action;
  • PUT replaces an entire existing resource, while PATCH applies partial updates;
  • DELETE removes the specified resource from the server.

Responses can also include explicit cache-control headers, allowing CDNs and reverse proxies to serve repeated GET requests directly from memory and reduce origin load.

Example

In a DevOps workflow, you might query a cloud provider's REST API using curl to inspect or provision infrastructure. Passing an authorization header and JSON payload creates a new server resource:

curl -X POST https://api.example.com/v1/instances \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"hostname": "worker-01", "region": "eu-west", "plan": "vps-4gb"}'

A successful request returns a 201 Created status along with a JSON object containing the new instance ID and assigned IP address.

What matters when choosing a server or hosting

Hosting a production REST API requires low network latency, predictable CPU performance for JSON serialization, and reliable process management. Because REST APIs are stateless, horizontal scaling behind a reverse proxy like Nginx or HAProxy is straightforward, provided your database connection pool can handle concurrent workers.

If your API serves automated workers or high-frequency external clients, process stability is critical—configuring automatic service recovery, similar to the systemd setups detailed in our Auto Restart Bot on VPS: Setup Guide and Reliability Data, prevents prolonged downtime after memory spikes. For outbound API integrations or data collection pipelines that interact with rate-limited endpoints, routing traffic through dedicated infrastructure as covered in Scraping with Rotating Proxies VPS: Performance Data helps maintain consistent throughput.

Common mistakes

  • Storing session state in server memory: Breaking statelessness prevents horizontal scaling and causes authentication failures when requests hit different backend nodes.
  • Using verbs in endpoint URLs: Endpoints should use plural nouns (/v1/orders/42) rather than action names (/v1/deleteOrder?id=42), letting the HTTP method define the operation.
  • Returning 200 OK for errors: Wrapping error messages inside a 200 response breaks standard HTTP client error handling and monitoring tools; always use proper 4xx and 5xx status codes.
  • Omitting pagination on list endpoints: Returning tens of thousands of database rows in a single GET response exhausts server RAM and causes gateway timeouts.

FAQ

Is REST a protocol or an architectural style?

REST is an architectural style, not a strict protocol. While it almost always runs over HTTP, it is a set of design constraints—such as statelessness and uniform interfaces—rather than a formal specification with rigid rules.

What is the difference between PUT and PATCH?

PUT replaces the entire target resource with the request payload, meaning omitted fields may be reset to null or default values. PATCH only modifies the specific fields included in the request body.

How do you version a REST API safely?

The most common and transparent approach is URI versioning, such as prefixing routes with /v1/ or /v2/. This lets you introduce breaking schema changes without disrupting existing clients relying on older endpoints.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.