Multiple Web service urls for a single class

We are finding a need to create custom search queries for Obs in this case being able to query all the obs that match a specific concept and value without having to specify a patient, ie for all patients.

From my little webservice knowledge, I would think that adding /obscustom should work as an additional mapping for the Obs class, but I have been told that this is not possible. Is this planned support in the future?

The crude way of dealing with this would be to create a CustomObs class that extends Obs class, and resources without having any additional implementation but it does not feel clean

@carapai @slubwama

I’m not sure if I’m completely understanding your question, but are you aware that we support letting modules add custom “search handlers” to a resource, which will be triggered based on the combination of parameters that you pass to the query?

Limited documentation at https://wiki.openmrs.org/x/CoRNAg.

I.e. you don’t need a new resource, you can just add a search handler for obs.

@darius this is just what I was looking for.

Another question can the search handler be in a custom module so that it is used for that module only?

I believe any other module can use the search handler as long as the module that contains it is present and started.

They can definitely use by any module, because they affect the REST web service interface, which is outside of Java.