코딩도 개발... 축구도 개발... 하...

2019년 2월 24일 일요일

Summary of HTTP Methods for RESTful APIs

Summary of HTTP Methods for RESTful APIs

Below table summarises the use of HTTP methods discussed above.
HTTP METHODCRUDENTIRE COLLECTION (E.G. /USERS)SPECIFIC ITEM (E.G. /USERS/123)
POSTCreate201 (Created), ‘Location’ header with link to /users/{id} containing new ID.Avoid using POST on single resource
GETRead200 (OK), list of users. Use pagination, sorting and filtering to navigate big lists.200 (OK), single user. 404 (Not Found), if ID not found or invalid.
PUTUpdate/Replace404 (Not Found), unless you want to update every resource in the entire collection of resource.200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid.
PATCHPartial Update/Modify404 (Not Found), unless you want to modify the collection itself.200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid.
DELETEDelete404 (Not Found), unless you want to delete the whole collection — use with caution.200 (OK). 404 (Not Found), if ID not found or invalid.

댓글 없음:

댓글 쓰기