Is HTTP 501 suitable for an unimplemented API?

Is the HTTP 501 error suitable for functions that the server plans to support, but currently does not exist, for example, a specific API case? For example, if I was developing a webmail application and I still could not delete emails with attachments, would it be appropriate to give 501 if I received a DELETE request by email with an attachment?

The RFC says that it should be used for an unknown method (for example, a PARTY request), but it is unclear whether it should be used for other functions.

+5
source share
1 answer

Appropriate

No :

6.6.2. 501 not implemented

A status code 501 (not implemented) indicates that the server does not support the functions necessary to fulfill the request. This is the appropriate response when the server does not recognize the request and cannot support it for any resource .

Use 405 :

6.5.5. 405 Method not allowed

A status code of 405 (method not allowed) indicates that the method obtained in the query string is known by the origin server, but is not supported by the target resource . The source server MUST create an Enable header field in the 405 response containing the list of target resources currently supported.

+6
source

Source: https://habr.com/ru/post/1232725/


All Articles