What is a REST API?

DEFINITION

A REST API is a web API that follows REST conventions: resources have URLs, standard HTTP methods like GET and POST act on them, and responses are usually JSON.

REST, short for Representational State Transfer, is an architectural style for designing networked APIs. In a REST API, every resource, such as a customer, order or product, has its own URL. Clients use standard HTTP methods to work with those resources, and the server responds with a representation of the resource, typically JSON.

REST APIs are stateless: each request contains everything the server needs, such as authentication, so the server does not rely on remembering previous requests. That makes them easier to scale and cache.

Why REST APIs matter

Because REST builds on plain HTTP, it works with any programming language, browser or tool that can make web requests. Developers find well-designed REST APIs predictable: once you understand one resource, you understand the pattern for all of them.

Most SaaS products, payment providers and CMS platforms offer REST APIs, making REST the most common way business systems connect.

REST in practice

Imagine an API for orders. GET /orders lists orders and GET /orders/1042 retrieves one. POST /orders creates a new order with details in the JSON body. PATCH /orders/1042 updates part of it, for example its status, and DELETE /orders/1042 removes it. The server signals the result with status codes: 200 OK for success, 201 Created after a successful POST, 400 Bad Request for invalid input, 401 Unauthorized when credentials are missing, 404 Not Found when the order does not exist, and 500 for a server error.

Best practices

  • Use plural nouns for resources and let HTTP methods express the action.
  • Return accurate status codes and clear error messages in a consistent format.
  • Version the API, for example /v1/, so you can make changes without breaking clients.
  • Paginate list endpoints so large collections do not overload clients or servers.

Common mistakes

  • Putting verbs in URLs like /getOrders or /deleteUser instead of using HTTP methods.
  • Returning 200 OK with an error message in the body, which hides failures from clients.
  • Changing response fields without versioning and breaking existing integrations.

Frequently asked questions

What is the difference between REST and GraphQL?

REST exposes many endpoints, each returning a fixed shape of data. GraphQL usually exposes one endpoint where the client describes exactly which fields it wants. GraphQL can reduce over-fetching for complex interfaces, while REST is simpler, caches well over HTTP and is more widely supported.

Is REST the same as HTTP?

No. HTTP is the protocol that carries requests and responses on the web. REST is a set of design principles that make use of HTTP features such as URLs, methods and status codes. You can use HTTP without following REST, and most REST APIs are built on HTTP.

How are REST APIs secured?

Common approaches include API keys, OAuth access tokens and signed requests, always sent over HTTPS. Servers should validate every input, check that the authenticated user is allowed to access each resource, and apply rate limits. Following the OWASP API security guidance helps avoid common vulnerabilities.

Need help with this?

Individualsoftware by VYZEON — Software, die sich Ihrem Unternehmen anpasst — nicht umgekehrt.

Fixed packages from $499. Written scope, no surprises.

See Individualsoftware

Related terms

More Web development terms