Leave a Comment
RESTful API basics
Table of Contents
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
1 2 3 |
/users/:username/repos /users/:username/repos/:repo /users/:username/repos?sort=date&order=asc |
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/
Similar Posts
LEAVE A COMMENT
Для отправки комментария вам необходимо авторизоваться.