Rest resource returning null object

I’ve extended the OpenMRS tables for a module. Then I added the rest calls for it. The calls work fine with uuid but not with the request parameter. It does bring the data in an array but shows null object.

I’ve tried by overriding doSearch function

@Override
protected NeedsPaging<Team> doSearch(RequestContext context) {
    return new NeedsPaging<Team>(Context.getService(TeamService.class).searchTeam(context.getParameter(parameter)), context);
    }

The above function returns data and has rows for the query.

The stack trace can be viewed on https://paste.ee/p/zEzDw

I don’t fully understand what’s going on, can you share the entire code for your rest resource? And remember to always use ask.openmrs.org when seeking help. talk.openmrs.org is meant for discussions

Thanks for the information. I’ll keep that in mind. I upload the code in a while.

MUHAMMAD SAFWAN Software Engineer Interactive Health Solutions www.ihsinformatics.com

The full code can be found on https://paste.ee/p/9p1TZ .

Actually the resource is returning null with the request parameter but works fine with uuid.

Hi,

You didn’t include the request you are making for this resource.

My guess is that you are trying to request the “display” field in your custom representation. There is currently a bug (which I just fixed, but hasn’t been released yet) where you can’t include the “display” property when requesting a custom representation. It looks like you copied the incorrect code findMethod(“getDisplayString”) into your resource.

See the commit on RESTWS-502 for how to fix this: