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?