HTTP 201 Created vs 501 Not Implemented
HTTP 201 (Created) is a 2xx Success response, while 501 (Not Implemented) is a 5xx Server Error response. 201 indicates that the request succeeded and a new resource was created. Typically returned after POST or PUT requests that create a new entity. In contrast, 501 means that the server does not support the functionality required to fulfill the request. The server either does not recognize the request method or lacks the ability to fulfill it.
คำอธิบาย
The request succeeded and a new resource was created. Typically returned after POST or PUT requests that create a new entity.
เมื่อคุณพบเห็น
After successfully creating a new user, post, order, or other resource via a REST API.
วิธีแก้ไข
No fix needed. Check the Location header for the URL of the new resource.
คำอธิบาย
The server does not support the functionality required to fulfill the request. The server either does not recognize the request method or lacks the ability to fulfill it.
เมื่อคุณพบเห็น
When using an HTTP method (like PATCH) that the server doesn't support.
วิธีแก้ไข
Use a different HTTP method that the server supports. Check server documentation.
ความแตกต่างหลัก
201 is a 2xx Success response, while 501 is a 5xx Server Error response.
HTTP 201: The request succeeded and a new resource was created. Typically returned after POST or PUT requests that create a new entity.
HTTP 501: The server does not support the functionality required to fulfill the request. The server either does not recognize the request method or lacks the ability to fulfill it.
You encounter 201 when after successfully creating a new user, post, order, or other resource via a REST API.
You encounter 501 when when using an HTTP method (like PATCH) that the server doesn't support.
ควรใช้อันไหนเมื่อไร
For 201 (Created): No fix needed. Check the Location header for the URL of the new resource. For 501 (Not Implemented): Use a different HTTP method that the server supports. Check server documentation.