-1

For example, we have an API POST /test, which only accept name: AA or name: BB headers.

If a client send a name: CC header, which status code is preferred?

400? 404? 500?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Sato
  • 8,192
  • 17
  • 60
  • 115
  • 2
    Read [ask] and share your research. There are literally thousands of questions about _"which status code to return in scenario X"_. – CodeCaster Feb 15 '18 at 09:16
  • 1
    Possible duplicate of [What is the most appropriate HTTP status code to return if a required header is missing?](https://stackoverflow.com/questions/10576898/what-is-the-most-appropriate-http-status-code-to-return-if-a-required-header-is) – CodeCaster Feb 15 '18 at 09:17
  • 1
    https://stackoverflow.com/questions/11461037/appropriate-http-status-code-for-request-specifying-invalid-content-encoding-hea, https://stackoverflow.com/questions/3050518/what-http-status-response-code-should-i-use-if-the-request-is-missing-a-required, https://stackoverflow.com/questions/9454811/which-http-status-code-to-use-for-required-parameters-not-provided, https://www.google.com/search?q=http+status+code+for+incorrect+request+headers – CodeCaster Feb 15 '18 at 09:18

1 Answers1

0

If is a permission problem maybe you can send 403 (forbidden). 404 is not found and is not the correct meaning of that and 500 is a server error.

jimixjay
  • 74
  • 7