com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError)

here is the repo @dkayiwa GitHub - jnsereko/jnsereko-module-task1

Did you forget this?

sorry @dkayiwa GET /openmrs/ws/rest/v1/task1/patient?nameOrMobile=0708443737

Make your controller as simple (with nothing more) as the one you see here: Adding a Web Service Step by Step Guide for Module Developers - Documentation - OpenMRS Wiki

1 Like

@dkayiwa i have reverted my controller to be as Adding a Web Service Step by Step Guide for Module Developers - Documentation - OpenMRS Wiki and added a search handler but now the resource v1/task1/patient is unknown

According to that documentation, the url should be in this format /ws/rest/v1/yourmoduleid/yourresourcename

You also need to drop /rest/" + from your resource class.

@dkayiwa can you kindly have like 10 minutes we meet synchronously in a video call

@dkayiwa i didn’t know the module group id had to be specific to openmrs :laughing:

Not related to the recursion error, getting all the patients is very inefficient, if there are thousands of patients not only will be slow, but you can consume all the memory. You should use a Query or Criteria to filter by mobile phone.