Search code examples
pythondjangorequestdjango-rest-frameworkhttp-status-codes

What status code should a PATCH request with no changes return?


If a PATCH request is made with a VALID payload, but the values in the payload are exactly the same as those in db, should it return 200 or 400 or other status code?


Solution

  • You have to return 4xx HTTP status code if there is an error.

    In your case, there is not so I think that 200 is the best response.

    The RFC says when you have to return an error status code.

    https://www.rfc-editor.org/rfc/rfc5789#section-2.2