4

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!

1 Answer 1

14

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.

Sign up to request clarification or add additional context in comments.

1 Comment

That makes much more sense than my original approach. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.