I give a general example of user login / logout for discussion HTTP methodand status code. Hope this helps people understand easily.
HTTP method
status code
Traditional carefree api design:
When a user logs in / logs out to a website, he will definitely get access to the server service by the HTTP request of the method POST.
POST
This is beyond doubt.
But if I follow the resty api design template, will it still be designed?
My thought:
Loginwill generate a token key when a user logs in. I think this is an action to create a database, because it generates a token key, so should it return a status code 201 Created?
Login
201 Created
Logout , . , db, , 204 No content ?
Logout
204 No content
, , , HTTP, API, ?
, . .
, , , . , , 200, 201 204, code >= 200 && code < 300. . , 201 204, - .
code >= 200 && code < 300
201
204
. POST /login login, POST /items, item, API . a 200 OK , , . , , 200 .
POST /login
login
POST /items
item
200 OK
200
Source: https://habr.com/ru/post/1612867/More articles:matplotlib and numpy - color and normalization of the histogram - pythonSearch algorithm if triangles formed by a set of points contain an origin or not and give a general score? - algorithmPHP "PUSH" In Javascript - javascriptNumber of triangles containing point (0,0) - algorithmtriangular points around the point - geometryPandas: exponentially decreasing sum with variable weights - pythonAPI Youtube - нет имени канала - youtubewebRTC with local area network - html5Yii2 model-> created_date в будущем и не возвращается по запросам - phpMongoDB insert with unique index - mongodbAll Articles