I have a RESTful service where I need to return a boolean equivalent. If the query returns true, I will return a 200 status, but am not sure what to return on false. I was thinking it should be a 4** status, but which one? Would 404 be considered the most appropriate?
Thanks!
You should return 200 on both cases. Then return a content-type header of text/plain and include the string "true" or "false".
Most languages should have no problem parsing those strings into a native type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With