Building apps

What is a REST API?

A REST API is an API organized around resources, where each resource has a URL and standard HTTP methods say what to do with it: get it, create it, change it, or delete it.

New to Bolt? Sign up free.

Technical definition

REST (representational state transfer) is an architectural style for web APIs. Its conventions:

  • Resources are the nouns, each addressed by a URL such as /customers/42
  • HTTP methods are the verbs: GET to read, POST to create, PUT or PATCH to update, DELETE to remove
  • Statelessness means each request carries everything needed to serve it; the server holds no session between calls
  • Status codes report the outcome: 2xx for success, 4xx for a client error, 5xx for a server error

Responses are usually JSON. The mapping to CRUD is direct, which is why REST fits data-driven applications so naturally.

In plain terms

A REST API is an API that follows a common set of conventions, so once you have used one you can guess how the next one works.

The URL says which thing. The method says what to do with it. The status code says how it went.

Why it matters

The value of REST is predictability. Because most web APIs follow the same conventions, integrating with a new service is a matter of reading which resources it exposes rather than learning a new system.

The status codes are worth recognizing even if you never write a request, because they are what you see when an integration fails. A 401 means the credential was rejected. A 403 means the credential is valid but not permitted. A 404 means the resource does not exist. A 429 means you called too often. A 500 means the other side broke. Those five cover most integration problems and each points to a different fix.

The main alternative is GraphQL, where the client specifies exactly which fields it wants in one query rather than calling several endpoints. REST remains the default for most services.