Open louh opened 11 years ago
You should be able to format the response any way you want. When querying/retrieving a single number, you should be able to format that response to match the format of the search response. In Rails, there are many different ways to accomplish this. Some of the more popular ones are RABL, JBuilder, Roar and Grape Entity.
I'm sure there's something similar for whatever framework you are using.
It duplicates the functionality as querying / retrieving a single number but the benefit is that the response comes back in a similar format to the search functionality. Predictability is nice.