What Is a REST API? Check REST Constraints and Resource Discovery
REST is an architectural style for distributed hypermedia systems, not a URL pattern or a synonym for JSON. Roy Fielding's 2000 dissertation describes constraints including client-server, statelessness, caching, a uniform interface, and a layered system; code-on-demand is optional.
REST is an architectural style for distributed hypermedia systems, not a URL pattern or a synonym for JSON. Roy Fielding's 2000 dissertation describes constraints including client-server, statelessness, caching, a uniform interface, and a layered system; code-on-demand is optional. An API that uses HTTP methods and JSON is therefore not automatically REST. The key questions are whether clients manipulate resources through representations, messages explain how to process them, and hypermedia guides the client's next state transition.
This guide uses Fielding's definition and the 2022 HTTP semantics standard, RFC 9110, to assess REST APIs. It does not prescribe a particular JSON media type or framework.
What problem is REST intended to solve?
The Web brings together components built independently, such as browsers, servers, proxies, and caches. If every client must know a server's internals or every URL rule in advance, a server change can force client changes too. REST generalizes the interface between components so they can evolve independently. That generality has a trade-off: a representation may be less efficient than an application-specific call, while caches and intermediaries that understand common rules can handle requests more easily.
REST is not the name of one technology or specification. HTTP is a prominent Web architecture to which REST has been applied; the HTTP specification does not declare every HTTP API to be REST. Assess an API against the constraints below.
What are REST's constraints?
| Constraint | Meaning | Effect and trade-off |
|---|---|---|
| Client-server | Separates user-interface concerns from data storage and processing. | Lets each side evolve independently, but requires clear responsibilities and network communication. |
| Statelessness | Each request carries the information needed to process it; the server does not rely on hidden client-session context from earlier requests. | Requests can be understood independently and server resources reclaimed more easily. Repeated authentication or context can increase traffic. It does not eliminate stored resource data. |
| Cache | Responses indicate whether and under what conditions they may be reused. | Can reduce repeated requests, latency, and load; incorrect freshness or validation rules can expose stale representations. |
| Uniform interface | Uses resource identification, manipulation through representations, self-descriptive messages, and hypermedia as the engine of application state. | Shared semantics reduce coupling, at the cost of being more general than an interface tailored to one application. |
The uniform interface has four parts. Resource identification distinguishes things such as an order or product. Manipulation through representations means reading or changing resource state using its representation and HTTP methods. Self-descriptive messages use metadata such as the method, media type, status code, and cache directives to explain how a message is processed. Hypermedia uses links or action information in a representation to show possible next state transitions.
Statelessness does not mean “the server stores no data.” A server may persist resource state such as orders, accounts, or inventory. The constraint means it does not implicitly retain client-session context across multiple requests. Authentication information can still accompany each request and identify a client or its permissions; the details depend on the application design.
How can you check hypermedia in an order API?
The following is a hypothetical illustration, not a claim about a real URL or documented media type. Suppose a new client starts at the server entry point, discovers an order collection, creates an order, and checks whether cancellation is available.
The client sends GET /; suppose the response provides a link to the order collection in a JSON representation.
GET / HTTP/1.1
Host: shop.example.test
Accept: application/jsonResponse message:
HTTP/1.1 200 OK
Content-Type: application/jsonRepresentation body:
{
"links": {
"orders": {"href": "/orders"}
}
}The client follows the orders relation instead of guessing a /orders URL rule. The collection can provide links for individual orders. After order creation, the response can return the new resource's location and representation; that representation might include a link for an action such as cancellation if it is currently available.
For example, a representation could contain an order identifier, a pending status, a self link, and a cancellation action link. This is illustrative only and specifies neither a real API URL nor a real media type.
This JSON is a hypothetical format example. Unless a media type defines link behavior as standardized control information, arbitrary JSON fields alone do not make a message self-descriptive. Client and server must share the meaning of the media type and link relations such as self, orders, or cancel. The client can follow links and offer a transition only when the current representation includes the cancellation action. The server must still recheck authorization and current state when a request arrives. The absence of a link does not guarantee that an action is impossible in every circumstance.
The flow illustrates that the server owns state and URIs, while the client reads representations and selects transitions offered there. The meaning of actual HTTP response status codes, Location, and cache directives is governed by RFC 9110 and the API's contract.
Is an “HTTP + JSON” API a REST API?
Using HTTP and JSON is not sufficient. An API may use HTTP yet fail to follow REST's uniform interface, especially hypermedia-driven state transitions, if clients must know operation URLs such as /getOrder, /createOrder, and /cancelOrder in advance, ignore response links, and hard-code JSON structures and URL rules.
JSON can carry hypermedia if its media type clearly defines resource representations, link relations, and available controls, and clients follow those instructions. REST does not require JSON: HTML or other media types can be representations too. When an API is called “RESTful,” ask which interface constraints and hypermedia format it implements, rather than checking only for HTTP methods or noun-shaped paths.
| Check | Evidence to inspect |
|---|---|
| How does a client find resources? | Does it hard-code every path, or use a known entry point and link relations? |
| Does a request depend on hidden server session state from an earlier request? | Does each request carry needed authentication and context, or implicitly depend on a server session? |
| Can responses be cached? | Do messages state whether they are reusable and how to validate them? |
| Are message formats and meanings described? | Can clients understand the meaning of Content-Type, status, link relations, and control fields? |
| Can the next action be discovered in a representation? | Does the client follow response links or controls rather than compose arbitrary paths? |
| Can intermediaries work? | Are caches, gateways, or proxies coupled to internals beyond their layer? |
Whether REST is a good fit depends on requirements. Its constraints may be worth the cost when independently evolving clients, caches and intermediaries, or dynamically guided actions matter. A fixed contract and generated clients may be more practical for an internal service. Choose based on the independence, cacheability, and discoverability you need, not the label “REST.”
Sources
[Roy Fielding, Architectural Styles and the Design of Network-based Software Architectures, Chapter 5: REST](https://ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm)
[RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html)