0

In our API, we ask mandatorily for client source in the http request header with values as:

  1. 1-Desktop
  2. 2-Mobile
  3. 3-Apps

What should be status code returned if we get header input other than 1,2,3.

Should it be bad request or unauthorized?

Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
  • Most common response in these cases is 400. But 422 also works. Don't use 401 unless someone is not logged in or does not have a valid auth token. – Ray Toal Dec 14 '17 at 06:28
  • You could try 415 " Unsupported Media Type" More about it [here](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) – oneturkmen Dec 14 '17 at 06:33
  • 1
    Mandating a specific client type is IMHO an anti pattern and has nothing to do with "REST". – Julian Reschke Dec 14 '17 at 08:20

0 Answers0