GET /cohort/{parent-uuid}/member on OpenMRS v2.1.0 returns Response Code 400

I was trying out the REST API on platform 2.1.0 on my local server instance. The aforementioned rest call seems to be returning a response code 400 with the following response body:

Response URL:

http://localhost:8080/openmrs/ws/rest/v1/cohort/h9a7m0i6-15e6-467c-9d4b-mbi7teu9lf0g/member

Response code:

400

Response body:

{
  "error": {
    "message": "[converting class org.openmrs.module.webservices.rest.web.v1_0.wrapper.openmrs1_8.CohortMember1_8 to org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation@40c8a687]",
    "code": "org.openmrs.module.webservices.rest.web.ConversionUtil:403",
    "detail": "org.openmrs.module.webservices.rest.web.response.ConversionException: converting class org.openmrs.module.webservices.rest.web.v1_0.wrapper.openmrs1_8.CohortMember1_8 to org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation@40c8a687\n\tat org.openmrs.module.webservices.rest.web.ConversionUtil.convertToRepresentation(ConversionUtil.java:403)rg.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription$Property.evaluate(DelegatingResourceDescription.java:252)\n<truncated>"
  }
}

Response headers:

    {
      "date": "Mon, 20 Feb 2017 20:03:31 GMT",
      "server": "Jetty(9.3.3.v20150827)",
      "content-length": "2662806",
      "content-type": "application/json;charset=utf-8"
    }

I can very well query the cohort:

Request URL:

http://localhost:8080/openmrs/ws/rest/v1/cohort

Response body:

{
  "results": [
    {
      "uuid": "h9a7m0i6-15e6-467c-9d4b-mbi7teu9lf0g",
      "display": "Example cohort",
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/cohort/h9a7m0i6-15e6-467c-9d4b-mbi7teu9lf0g"
        }
      ]
    }
  ]
}

How do I troubleshoot and fix this?

Is there a more complete error in your server logs?

I have trouble finding the server logs. How do I access the server logs? This is run through jetty:run from the master branch of openmrs-core.

If you do jetty:run it’s just the console output. Is there an exception with a stack trace printed there when you send the failing request?

That helped to narrow down the problem. I have an openmrs module installed muzimacore that’s causing the problem. I guess that needs to be updated. I will talk to the muzima folks and get this resolved. Logs attached for posterity. Thanks.

logs.txt (607.5 KB)

I am nicky from AMPATH. We are trying to upgrade to openmrs 2.1.x. I also ran into the same issue. @vshankar, were you able to solve the issue? I tried stopping the muzima core module, but still faced the same issue. cc @darius

The Cohort API was redesigned in version 2.1 and above, the new request URL should be

/openmrs/ws/rest/v1/cohort/{parent-uuid}/membership