resthttp-status-code-404http-status-codes

REST 404 vs 400. Which one to use?


If I have a REST resource as shown below:

GET http://www.example.com/customers/{customerId}/orders

And in case the provided customerId does not exist, should my server return a 404 (Not Found) or a 400 (Bad Request)?


Solution

  • I believe it should be a 404 status, since the request was valid, however no customerID was found.