Details

    Description

      In the REST interface, sometimes we return 400 Bad request instead of a more appropriate 5xx like Internal server error (500). 4xx codes are client-related errors, ie something is wrong with the request. However, if the request itself is valid but cannot be fulfilled, it's better to use a server-related status code.

      There are other status codes which do not follow the meaning of the code and what to use instead:

      • An object (queue, partition, user, etc) does not exist: 400 Bad Request --> 404 Not Found
      • Internal metrics is disabled: 501 Not Implemented --> 500 Internal Server Error
      • Event tracking disabled: 400 Bad Request --> 500 Internal Server Error

      400 means that the request is malformed, eg. header or the request syntax is invalid.
      It's better to return 404 when an object is not found, because in this case, the request itself is properly formatted. The real problem is that it refers to a resource which does not exist.

      501 Not Implemented refers to a HTTP method (GET, POST, etc), not a functionality in the business logic.

      Attachments

        Issue Links

          Activity

            People

              pbacsko Peter Bacsko
              pbacsko Peter Bacsko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: