Visit Rest Api includes voided encounter

While querying through visit REST API using custom query. The voided encounters are also getting fetched. Are there any parameters that we can attach to the URL to fetch only unvoided encounters?

I am including includeInactive=false on my visit query.

openmrs version: 2.1.4 rest api version : 2.24

@darius @dkayiwa

Try includeAll=false

sure @dkayiwa. That should work . it was fixed here https://issues.openmrs.org/browse/RESTWS-684

1 Like

@kundansinha a normal REST API query should no include voided data, u can have a look at this for more info as u try out @dkayiwa suggestion

still getting voided encounter.

@dkayiwa @mozzy

which version of the restws-module are you using ?? can you clone and build the last code here

Rest Web Services OMOD 2.24.0.573609

No need to clone and build from source. Just download the latest released version. https://addons.openmrs.org/show/org.openmrs.module.webservices-rest

1 Like

I am using platform version 2.1.4 and ref app 2.9 I have not cloned and build it.

however even before you do any upgrade , the default behaviour would be that it shouldnt return voided encounters even when you dont include any parameter. see here. can you post the full request url here ??

Infact in the above Ticket , i was fixing the opposite, for us to enable retriving of voided encounters with
includeAll=true

1 Like

/openmrs/ws/rest/v1/visit?v=custom:(uuid,patient:(uuid,identifiers:(identifier),person:(display,gender,age,birthdate)),location:(display),encounters:(display,encounterDatetime,voided,encounterType:(display)))&includeInactive=false&includeAll=false

Any solution? @mozzy @dkayiwa @gcliff.

oh sorry i got a little bit up and down , but am going to investigate into this a little deeper

@kundansinha are you able to reproduce that problem here? https://qa-refapp.openmrs.org

@dkayiwa

In qa-ref app and demo server both it works in the way as @mozzy said no need of parameters it gives encounters which are not voided.can’t reproduce the issue

Yes. patient uuid : 8c8fd9b1-1f16-475f-b100-243aef6a4364

I am able to reproduce it. I voided an encounter through REST API and when I am fetching it through visit resource through custom query voided encounter is also getting fetched. Just check the above image I have attached.

this is on demo.openmrs.org

@kundansinha can you share the full url that i should use on the demo server to reproduce the problem?

https://demo.openmrs.org/openmrs/ws/rest/v1/visit?v=custom:(uuid,patient:(uuid,identifiers:(identifier),person:(display,gender,age,birthdate)),location:(display),encounters:(display,encounterDatetime,voided,encounterType:(display)))&includeInactive=false

you can void any encounter and then try fetching using the URL.

@kundansinha , i have tested this with the latest code (i cloned the latest code(rest-webservices) and built it) , it actually doesn’t return voided encounters by default. try building the latest code.

I by the way used you very custom URL here

http://localhost:8081/openmrs-standalone/ws/rest/v1/visit?v=custom:(uuid,patient:(uuid,identifiers:(identifier),person:(display,gender,age,birthdate)),location:(display),encounters:(display,encounterDatetime,voided,encounterType:(display)))