0

I have to handle some client requests to my server using rest.
The client makes a request sending an ID and I want to return suitable http-error-codes in case the ID

  • is invalid
  • doesn't exist

But unfortunately I'm not sure about the right code.

Evgenij Reznik
  • 16,046
  • 33
  • 87
  • 157

1 Answers1

1
  • is invalid: 400
  • doesn't exist: 404
  • existed before, but not anymore: 410
Tronix117
  • 1,927
  • 14
  • 18
  • Is it also possible just for an ID? I thought 404 is only possible if the entire page is missing. – Evgenij Reznik Apr 19 '12 at 17:00
  • 1
    In fact, in REST we work with resources, not really with pages. 404 means it doesn't exist right now, and precisely right now, but it may exist in the future. 410 is more explicit, it means it will never exist. 400 is just because the client request is wrong. – Tronix117 Apr 19 '12 at 17:02