API Directory โ€บ Guides โ€บ What Is a REST API? Explained Simply

What Is a REST API? Explained Simply

REST is the style almost every public API uses. Learn what REST means, the HTTP methods, and how to read an endpoint โ€” without the jargon.

A REST API is a web API that follows a set of conventions called REST (Representational State Transfer). It models everything as resources — users, orders, articles — each with its own URL, and uses standard HTTP methods to act on them. Most public APIs you will meet are REST or REST-ish.

Resources and methods

In REST, the URL names a thing and the HTTP method says what to do with it:

GET /articlesList articles (read, safe, no side effects)
GET /articles/42Read one article
POST /articlesCreate a new article (body carries the data)
PUT /articles/42Replace article 42 entirely
PATCH /articles/42Update some fields of article 42
DELETE /articles/42Remove article 42

Sub-resources nest: GET /articles/42/comments lists the comments on article 42; POST /articles/42/comments adds one.

The other REST ideas

A complete example

# create
curl -X POST https://api.example.com/v1/articles \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "Hello", "body": "..."}'
# -> 201 Created, Location: /v1/articles/99

# read it back
curl https://api.example.com/v1/articles/99 -H "Authorization: Bearer $KEY"
# -> 200 OK, { "id": 99, "title": "Hello", ... }

# delete it
curl -X DELETE https://api.example.com/v1/articles/99 -H "Authorization: Bearer $KEY"
# -> 204 No Content

‘RESTful’ in the real world

Few APIs follow every REST constraint to the letter, and that is fine. Common pragmatic deviations: actions that don’t map to a resource (POST /articles/42/publish), filtering and pagination via query strings (?status=draft&page=2), and bulk endpoints. When people say ‘REST API’ today they usually mean ‘JSON over HTTP, organised around resources and methods’.

REST vs. the alternatives

FAQ

What makes an API ‘RESTful’?

Organising it around resources with their own URLs, using HTTP methods for actions, staying stateless, and returning standard status codes. Full REST also requires hypermedia links, which most APIs skip.

Is every JSON API a REST API?

No — GraphQL and JSON-RPC also use JSON but are not REST. REST is about the resource-and-method structure, not the data format.

What status code should a successful POST return?

201 Created when a new resource is made (ideally with a Location header), or 200 OK / 204 No Content for actions that don’t create anything.

What is the difference between PUT and PATCH?

PUT replaces the whole resource with the body you send (omitted fields get cleared or defaulted). PATCH applies a partial update — only the fields you include change.

Keep going

Try it on a real API

Browse all 196 free APIs โ†’

๐Ÿ”Œ Explore free public APIs

Hundreds of free APIs, searchable by category, with auth & CORS at a glance.

Browse the directory โ†’