I'm using HAPI-FHIR library and I'm trying to introduce a new search parameter to resource provider for example :
@Read
public Patient getResourceById(@IdParam IdDt id,
@RequiredParam(name="session") String session){}
But I have an exception
"ca.uhn.fhir.rest.server.ConfigurationException: Method[public ca.uhn.fhir.model.dstu.resource.Patient PatientResourceProvider.getResourceById(ca.uhn.fhir.model.primitive.IdDt,java.lang.String)] is not allowed to have a parameter annotated with @ca.uhn.fhir.rest.annotation.RequiredParam(compositeTypes=[], chainBlacklist=[], targetTypes=[], chainWhitelist=[*], name=session)"
Any suggestions how to do it?
The problem here is that this method is annotated with @Read, so it's a "read"/"vread" and not a "search". To create a search method which accepts that one parameter, copy your existing method, remove the first parameter, and change @Read to @Search.
Note that you may also want to return List instead of just Patient since a search can return multiple results.