httphttp-status-codeshttp-status

Which HTTP Status code should indicate failed to carry out some code due to invalid input?


I have a POST request that require a user id. If that user id is found, then everything is successfully is carried out and the default http code is returned (i.e. 200). If the user id is not found, what should I return? Non of the 4xx seem to fulfill my case.


Solution

  • I have a POST request that require a user id.

    But how is this id sent to the server?

    Your question lacks plenty of details on what you are trying to achieve, so it's tricky to suggest something. But here are some scenarios I can think of: