How to distinguish 404 between entity doesn't exist and incorrect endpoint?

前端 未结 4 946
無奈伤痛
無奈伤痛 2021-01-02 00:34

Using REST principles, 404 seems to be used to indicate that an entity does not exist. However, how can clients distinguish this case from hitting an incorrect endpoint alt

4条回答
  •  Happy的楠姐
    2021-01-02 00:56

    you came to the right endpoint, but that entity doesn't exist

    If there is no resource identified by the URL, how could it be the right endpoint? The only possible scenario I could think of is that the entity has been deleted, in which case 410 Gone is the correct response.

    Remember that if you are following RESTful principles then the URL should have been provided by the server and if so, why is the server handing out invalid URLs?

提交回复
热议问题