RESTful API basics

It is a way to structure your API over HTTP.
REST stands for “Representational State Transfer”.
It has 5 major parts:

  • The endpoint
  • The method
  • The headers
  • Request body
  • HTTP status

Endpoint paths

Could be something like

Methods

GET Read entry/list of entries
POST Create an entry
PUT Update all entry fields
PATCH Update few entry fields
DELETE Delete an entry

Headers

Are used for content types, auth.

Request body

Is used for creating/updating entries

HTTP statuses

200 — ok
401/403 — not auth
404 — not found
5xx — server issue
More on them on the link below.

https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/
HTTP statuses — https://restfulapi.net/http-status-codes/

LEAVE A COMMENT