I worked with Ruby on Rails and RESTful api before and now with Django Rest framework. For this question let's say we only consider the case of JSON but not XML. It seems that when we expect an array as a result, if the result is 1 or above, we can happily get back an array with the proper content, but if the result is 0, we don't get back an empty array -- it actually will return a 404 HTTP status code with empty response content?
Is this always the case with RESTful resources, and is it true that if we don't define our API as REST or resource, then we can do whatever we want (and return an empty array)?
In a way, I think if it is math or functional programming, I would think that if a function returns a set or an array when the number of items is 1 or above, but give you back a null or raise an exception, instead of returning an empty set or empty array, I think it is a little strange behavior. And in the case of recursion, such behavior usually doesn't work, so I wonder if a behavior that is more "mathematically correct" may be a better behavior. But this question is about RESTful... whether its definition is that it should be 404 with empty response content but cannot be otherwise.