Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A REST API lets software interact with resources over a network using a defined interface. In a common web API, a client sends an HTTP request to an endpoint, and a server returns an HTTP response. REST is an architectural style; HTTP is a protocol often used to implement it. Using HTTP alone does not make an API RESTful.

What is a REST API?

REST stands for Representational State Transfer. It is an architectural style for networked systems, not a programming language or a specific data format. An API designed around REST lets a client interact with resources through representations of those resources.

HTTP is the protocol commonly used for web APIs. Its standardized messages, methods, and status codes provide much of the vocabulary developers use when discussing REST APIs. But an API can use HTTP without following REST’s architectural guidance. Roy Fielding’s dissertation discusses REST and its application to HTTP: Architectural Styles and the Design of Network-based Software Architectures.

What are endpoints, requests, and responses?

Endpoint: where the client directs a request

An endpoint is commonly the URI a client addresses to interact with a resource through an API. For instance, an API might use https://api.example.com/books/42 to identify a particular book. That path is illustrative, not a universal REST naming rule. HTTP identifies a request’s target with a URI; the server determines how that identifier maps to its implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Request: what the client asks the server to do

An HTTP request includes a method and a request target. It may also include headers, which carry additional information, and content, sometimes called a request body. The method is the primary source of the request’s semantics: it communicates the kind of operation the client intends.

Response: what the server returns

An HTTP response includes a status code and may include headers and content. The status indicates the broad outcome; any content provides further information, such as a resource representation or an error explanation. A response does not always have a body. RFC 9110, the IETF’s HTTP Semantics standard published in June 2022, puts the basic model simply: “Each message is either a request or a response.” RFC 9110.

What do the common HTTP methods mean?

Methods have standardized meanings in HTTP, but a particular endpoint does not necessarily support every method. The API’s documentation defines which methods it accepts and any additional behavior.

Method Standardized intent What to expect
GET Request a current representation of the target resource. The response may contain the requested representation, but a body is not guaranteed for every response.
POST Ask the target resource to process the submitted content according to its own semantics. Processing can include creating a resource, but POST does not mean “create” in every API.
PUT Request replacement of the target resource’s current representations with the submitted content. Check the API documentation for the expected content and effect.
DELETE Request removal of the target resource’s current representations. The server’s response describes the outcome; successful deletion does not require a response body.

These definitions describe HTTP semantics, not a promise that a given server allows an operation. For the standard definitions, see RFC 9110.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
REST API Design Rulebook
  • Used Book in Good Condition

How do you read an API response?

Start with the status code

HTTP status codes are three-digit numbers in the range 100–599. Their first digit identifies a broad class: 1xx is informational, 2xx successful, 3xx redirection, 4xx client error, and 5xx server error. The particular code matters. For example, 202 Accepted means processing was accepted but is not complete; it does not say the work has finished.

204 No Content is a successful response with no content. More generally, do not assume that a successful response includes a body. Interpret the status alongside the response content, if present, and the API’s own documentation. See RFC 9110’s status-code definitions.

Check the representation format

REST does not require JSON. An API may communicate representations in different formats; the format is signaled and interpreted using relevant representation metadata and the API documentation. JSON is common, but “REST API” and “JSON API” are not interchangeable terms.

Recognize structured error details when present

Some APIs use Problem Details for HTTP APIs, a format defined by RFC 9457. Its common members include type, title, status, detail, and instance. The status member is advisory: generic HTTP software should rely on the actual response status code. Not every API uses this format, so consult the API’s documentation rather than expecting a particular error-body shape.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to compare two API endpoints

When learning an API or choosing between endpoints, compare the parts that determine what you send and what you can expect back:

  • Resource and URI: What resource does each endpoint target?
  • Allowed method and effect: Which HTTP methods are supported, and what does each one do for that resource?
  • Request requirements: Which headers are needed, and must the request include content? What format and fields are expected?
  • Response statuses: Which success and error status codes are documented, and what do they mean for this operation?
  • Response representation: What format and fields does the endpoint return, if it returns content?

This comparison helps distinguish endpoints that appear similar but accept different inputs or produce different outcomes. The API documentation is the authority for endpoint-specific requirements; HTTP defines the general message and method semantics in RFC 9110.

What should you remember about REST APIs?

  • REST is architectural guidance; HTTP is a protocol often used to build web APIs.
  • An endpoint identifies a target for interaction, while the server controls how that identifier is implemented.
  • A request combines a method and target and may include headers and content.
  • HTTP methods communicate standardized intent, but endpoints vary in what they support.
  • A response has a status code and may have content; neither JSON nor a response body is guaranteed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.