What does REST stand for, and what is a REST API?
REST stands for Representational State Transfer. Roy Thomas Fielding described it in his doctoral dissertation, “Architectural Styles and the Design of Network-based Software Architectures”, written at the University of California, Irvine, in 2000. Chapter 5 presents REST as an architectural style for distributed hypermedia systems.
Fielding introduces the idea with a design question about the Web itself. In section 5.1 he writes that “the design rationale behind the Web architecture can be described by an architectural style”. The style is that description, written as a handful of constraints that can be named and tested.
The word style carries the meaning. REST is not a file format, not a protocol and not a product. It is a set of constraints on how the parts of a networked system talk to each other, and a design is RESTful to the degree that it accepts them.
In daily use, a REST API is an interface that applies this style over HTTP. Things the system knows about have addresses, clients ask for and send representations of those things, and every request explains itself. The phrase web service points the same way: a service that programs reach over HTTP. Plenty of services use HTTP verbs and return JSON and still ignore several of the constraints below, so the label deserves a check rather than trust.
What are the REST constraints and principles?
Fielding’s chapter 5 builds REST up from a list of constraints: client-server (section 5.1.2), stateless (5.1.3), cache (5.1.4), uniform interface (5.1.5) and layered system (5.1.6). Code on demand (5.1.7) is described as “only an optional constraint within REST”. That makes five required constraints and one optional one.
| Constraint | Effect | What shows on the wire |
|---|---|---|
| Client-server | User interface and data storage are separate concerns, so each side can change on its own while the interface holds | A request from the client, a response from the server |
| Stateless | Each request carries what is needed to understand it | Credentials and parameters travel with every request |
| Cache | A response says whether it may be reused | Cache-Control and related headers |
| Uniform interface | All resources are handled in the same generic way | URI, method, media type, status code |
| Layered system | Intermediaries can sit between client and server | A proxy or gateway that forwards the request |
| Code on demand (optional) | The server may send code that extends the client | A script delivered in a response |
Each rule trades something for something. Separating client and server lets a mobile app, a browser and a script share one service, and lets the service change its internals without breaking them, as long as the interface keeps its promises. Statelessness makes every request independent, so no particular server has to remember the earlier ones. Cache rules cost the server a little care in labelling responses and give back lower latency and less work. Wrong labels do harm, though: a response that should be private but may be reused by a shared cache exposes data, and a response cached too long serves stale state. The layered system allows gateways, proxies and load balancers to be added without the client being rewritten. Code on demand is the odd one out, and the dissertation itself treats it as optional.
The uniform interface is the one with parts of its own. Fielding names four: identification of resources, manipulation of resources through representations, self-descriptive messages and hypermedia as the engine of application state. The first two are covered in the next section. Self-descriptive messages are the reason a response names its media type, and hypermedia means that a response tells the client what it can do next.
Stateless is the constraint most often misread. According to section 5.1.3, each request “must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server”. Read plainly, this does not say that the server stores nothing. A server can keep thousands of orders in a database. What it cannot do is depend on a hidden conversation, such as “this client logged in three calls ago”, to make sense of the next call. The conversation state lives with the client and is sent along each time.
What is a resource, and what is a representation?
Fielding defines a resource as “a conceptual mapping to a set of entities” (section 5.2.1.1). It is the thing behind an address, not a row in a table or an object in a program. Order 42 can be one resource even if its data is spread over four tables. HTTP uses the same word: RFC 9110 calls the target of a request a resource, and says that most resources are identified by a URI.
A client never touches the resource itself. It receives or sends a representation, a snapshot of the resource’s state in some format such as JSON, XML or HTML. The media type in the headers tells the receiver how to read the bytes. One resource can offer several representations:
| Request header | Representation returned |
|---|---|
Accept: application/json | {"id": 42, "status": "shipped"} |
Accept: application/xml | <order><id>42</id><status>shipped</status></order> |
Separating the two ideas has a practical payoff. A resource keeps its address while the formats offered for it grow or change. A client written against the JSON representation of order 42 keeps working when an XML representation appears next to it, because the address and the meaning of the order did not move.
Both rows describe the same order. Which format fits a given job is a separate question, taken up in XML vs JSON.
Addresses follow from this idea. Because the HTTP method already carries the action, resource URIs usually name things, such as /orders/42, rather than actions, such as /getOrder. That is common design advice and not a rule of the dissertation. Where a domain really contains a process, such as a payment run, modelling the process itself as a resource is a reasonable way out.
What does a REST API example look like?
A short order service shows the pieces working together. The host name is a placeholder.
- The client creates an order by sending a POST to the collection,
/orders, with a representation of the new order in the body. - The server creates it and answers
201 Created. RFC 9110 says a server that created a resource by POST should send 201 with a Location header, and here Location points to /orders/42. - The client reads the order with
GET /orders/42. The answer is 200 OK with a representation in the body. - To change it, the client sends PUT to the same address with the complete new state. The server answers 200 or 204.
- To remove it, the client sends DELETE. A
204 No Content response confirms success without a body.
POST /orders HTTP/1.1
Host: api.example.com
Content-Type: application/json
Accept: application/json
{"item": "notebook", "quantity": 2}
HTTP/1.1 201 Created
Location: /orders/42
Content-Type: application/json
ETag: "order-42-v1"
{"id": 42, "item": "notebook", "quantity": 2}
Steps four and five show why the choice of method matters. PUT names the address and supplies the whole new state, so sending it twice leaves the order as it was after the first call. DELETE behaves the same way: once the order is gone, a repeat has nothing further to remove. POST to the collection is different, because each call asks the server to make something new.
Every line has a job. The method and URI say what is addressed and what should happen, the media types say how to read the body, the status code reports the outcome, and Location gives the client an address it can use without guessing.
What is the difference between HTTP and a REST API?
RFC 9110 begins by calling HTTP “a stateless application-level protocol for distributed, collaborative, hypertext information systems”. A protocol fixes message formats, methods and status codes. REST fixes none of those. It is a set of constraints that a design can satisfy while using a protocol such as HTTP.
HTTP REST Kind Protocol Architectural style Described in RFC 9110 Fielding’s dissertation, chapter 5 Concerned with Methods, status codes, headers, message framing Constraints such as stateless interaction, cache and uniform interface
An HTTP API can break the style without breaking the protocol. A single endpoint that accepts every action as a POST with a command in the body is valid HTTP. It also gives up the uniform interface, because the meaning of each call is hidden in the payload.
The reverse also holds: following the style does not require every detail of HTTP to be used. What the constraints ask for is visible in how the interface is shaped. Does each address identify one thing? Does the method say what is wanted? Does the response say how to read it and whether it may be reused? Those questions can be put to any interface, and the answers say more about its design than the transport it happens to use.
A few neighbouring terms are worth separating. An API is any interface a program can call. A web API is one reached over the web. A REST API is a web API designed in the REST style. SOAP, a messaging protocol with its own envelope, is a different design again; SOAP vs REST compares the two with the same request.
What are REST API status codes, and when does each apply?
Status codes group by their first digit. 2xx means the request succeeded, and 4xx means the request was at fault. The exact codes carry more than the class, and a client can act on them without parsing the body. Forcing every outcome into 200 throws that information away.
Code Meaning When it fits 200 OK The request succeeded A read, or a change that returns the new state 201 Created A new resource exists After POST or PUT created something; send a Location header 204 No Content Success, nothing to send back A change or removal without a body 405 Method Not Allowed The resource does not support that method DELETE on a read-only resource; the response lists the allowed methods in an Allow header 409 Conflict The request clashes with the current state A PUT whose content contradicts the resource 415 Unsupported Media Type The server cannot read that format A body in a format the resource does not accept
Two details deserve attention. A 201 belongs with a Location header, because the client learns the address of the new resource from it. A 405 belongs with an Allow header, which RFC 9110 requires, so the client learns what it may do instead. Codes without those headers leave the client with a result and no next step.
Errors need the same care as successes. A stable, machine-readable error structure, the same on every operation, lets clients handle failures without guessing from text. How PUT and POST differ in the codes they return is worked through in PUT vs POST.
Is a RESTful API different from a REST API?
Mostly the words are interchangeable. This is an observation about usage, not a rule from a standard: people say REST API and RESTful API for the same kind of HTTP interface. The ending -ful only adds a claim, namely that the design follows the style.
The difference starts to matter when someone tests that claim. Fielding counts hypermedia as the engine of application state among the four uniform-interface constraints (section 5.1.5). Whoever asks whether a given API is RESTful therefore has to decide how strictly that list is read, and an API with resources and methods but no links from one response to the next has not met all four.
Which methods are safe and idempotent in a REST API?
RFC 9110 calls GET, HEAD, OPTIONS and TRACE safe. It defines a method as idempotent when the intended effect of several identical requests equals the effect of one. PUT, DELETE and all safe methods qualify. POST is registered as neither safe nor idempotent. The word intended matters: a server may still log every request, and the rule describes the effect the method asks for.
Method Safe Idempotent GET Yes Yes HEAD Yes Yes OPTIONS Yes Yes TRACE Yes Yes PUT No Yes DELETE No Yes POST No No
Safe and idempotent are statements about the method as defined, and they bind implementers. A service that changes data on a GET breaks what clients and caches assume about that method. A service that makes PUT append instead of replace breaks what every retrying client assumes.
The practical consequence appears after a failure. If a connection drops before the response arrives, a client may repeat an idempotent request without knowing whether the first one went through. Repeating a POST can create a second order. PUT vs POST follows exactly that case step by step.
How do I design and review a REST API? A checklist
The list below works as a review sheet. Each point can be checked by reading requests and responses, and a failed point usually names its own fix.
- URIs identify stable resource concepts rather than actions.
- HTTP methods match their defined safety and idempotency.
- Status codes distinguish meaningful outcomes.
- Representations declare precise media types.
- Cache rules are explicit and safe for the data involved.
- Conditional requests are supported where concurrent edits matter.
- Errors have a stable, machine-readable structure.
- The OpenAPI description matches what the service really does.
- Payload schemas declare their versions and dialects.
- Conversions to agent tools keep authentication and side-effect boundaries intact.
Used in practice, the list works best on real traffic: take five recorded requests and walk each through the ten points. Items three and seven are easy to test this way, because the status code and the error body are visible in every recorded response. Item eight compares the written contract with observed behaviour, and any difference there is a defect in one of the two.
Security sits beside the list, not inside it. OWASP’s REST Security Cheat Sheet covers topics such as HTTPS, access control, JWT, API keys, input validation and error handling, and each deserves its own review.
Which standards describe REST APIs and their contracts?
REST is described in Fielding’s dissertation. HTTP is specified in RFC 9110, with caching in RFC 9111.
A contract is a separate matter. OpenAPI describes the operations of an HTTP API, with their parameters, payload schemas, responses and security requirements. A valid OpenAPI document shows that an API is described, not that it follows REST. In OpenAPI the Schema Object is by default a superset of JSON Schema Draft 2020-12, and the description should name the OpenAPI version it uses. The latest published version is 3.2.1, from September 2026. Representations in XML can be described with XML Schema (XSD), a W3C language for defining a class of XML documents.
The three pieces answer different questions. Fielding’s dissertation says what the style is, RFC 9110 says how HTTP messages behave, and an OpenAPI description says what one particular service offers. Mixing them up leads to arguments in which one side quotes a style rule and the other a message format.
One more use has appeared around OpenAPI descriptions: turning operations into tools that software agents can call. An operation is not automatically a good tool. Tool descriptions have to help a model choose between operations, inputs should be bounded and described, output should be predictable, and calls that change state should keep truthful approval and risk semantics. The OpenAPI-to-MCP Readiness Analyzer checks these signals in a JSON-formatted OpenAPI description and produces a draft tool definition for review.
Frequently asked questions
01What does REST API stand for?
REST stands for Representational State Transfer, and API for application programming interface. A REST API is an interface that applies the REST architectural style, which Roy Fielding described in his 2000 dissertation, over HTTP.
02What is a REST API example?
A client sends GET /orders/42 and the server answers 200 OK with a representation of order 42, for example as JSON. Creating an order works the same way: a POST to /orders is answered with 201 Created and a Location header that names the new resource.
03What is the difference between HTTP and REST API?
HTTP is a protocol with methods, status codes and headers. REST is an architectural style that a design can follow while using HTTP, and an HTTP API can ignore it completely.
04What are REST API status codes?
They are the HTTP status codes a REST API uses to report the outcome of a request: 2xx for success, 4xx when the request is at fault. Typical ones are 200 for a normal read, 201 after creation, 204 for success without a body and 405 when the method is not allowed on that resource.
05What is a RESTful API vs REST API?
In everyday use the two terms name the same thing, an HTTP interface built in the REST style. RESTful stresses the claim to follow the style, and the claim can be tested against the constraints.
06What is idempotency in a REST API?
A method is idempotent when several identical requests have the same intended effect as one. RFC 9110 lists PUT, DELETE and the safe methods as idempotent, which is why a client may repeat them after a dropped connection.
07What is REST in programming?
It is a way of structuring the interface between programs that talk over a network. Instead of calling named procedures, a client reads and changes resources that have addresses, using a small fixed set of operations.
08What is meant by RESTful API?
An API whose design follows the REST constraints: client and server are separate, requests are stateless, responses can be cached, the interface is uniform and layers are allowed. The details of each constraint are covered above.