Search code examples
resthapihapi-fhir

Change search URL in HAPI-FHIR


I am currently working on a Hapi-FHIR project. There I want to implement a collection of Questionnar Responses by Patient. The collection gives back all QuestionnaireResponses of a Patient with a given PatientId. This works without problems but I also want to adhere to the REST Resource Naming Conventions. So the search URL for my Collection shoud look something like https://example.com/patient/{id}/questionnaireresponses. Right now my search URL looks like this: https://example.com/QuestionnaireResponse?patient={id} I already tried to set my own search Url with @Path("/patient/{id}/questionnaireresponses") but HAPI-FHIR seems to ignore this. I searched the HAPI-FHIR documentation already but I did not find anything related.

My question is where does the naming of the search urls happen in HAPI-FHIR and how can I change the name of a search url?


Solution

  • HapiFhir offers a mechanism for grouping two resources together. Using compartments solved my problem.