Search code examples
restapihttp-status-codesrestful-architecture

API rest response code for not handle endpoint


I have

/rest/drink/categories?alcohol=true

which is return 200 status code with list of drink categories that have alcohol in it, e.g.

200 ['wine','beer']

I wonder what status code should I use, if a user hit a none handled path like below

/rest/drink

or

/rest/drink?alcohol=true


Solution

  • 404 - Not found if the URL does not exist,
    400 - Bad request if the URL exists but the request parameter is invalid.