The voided field missing in orders (drug orders) in the REST api

Tags: #<Tag:0x00007f6002dfd9f0>

We are using OpenMRS API to integrate Bahmni EMR and Avni (another open source platform for community health). I am using an API like this: {{BASE_URL}}/ws/rest/v1/encounter/83837fc1-ae88-4df7-a161-d5c4cd7e755b?v=full

In the orders section, I do not see the voided field at all. While in the database we have some voided orders. Hence for integration, I need to be able to figure out which drug orders were voided and hence not sync them to the other system.

By default the Rest API doesn’t return voided objects

Since you’re viewing Orders as a property of a given Encounter , youll only view minimal data about the orders Resource . thas is you’ll only see display ,uuid ,link

check here REPRESENTATION.REF ,

see more https://wiki.openmrs.org/display/docs/REST+Web+Services+API+For+Clients#RESTWebServicesAPIForClients-Ref

This is what I am seeing. It has all the detailed fields not just display, uuid and link. But the voided field is missing as part of encounter response.

which version of the rest module do you run ??

Rest Web Services OMOD 2.24.0.573609 OpenMRS

thanks for replying

Are you requesting for the Full REP of the encounter resource ??

The voided property was removed from the order resource in version 1.10 but it existed for version 1.8

@dkayiwa was this intentional ??

yes. v=full

1 Like

ok, so this basically leaves anyone using the api in a bit of problem.

probably will delete the data from the database, as that may be the only option.

I see , thats why you get the default REP for orders.

see reason why voided property is not included

1 Like

He is using the encounter resource. Not the order resource.

ok got it thanks. if I use default I get the voided information for orders, fine. thanks.

full gives the impression that is has everything that is there to see. default having more data that full, I hadn’t thought.

@dkayiwa
we are talking about orders being returned as a property of an encounter Resource

The links you gave were for the order resource. Not the encounter resource which he is using.

@dkayiwa i gave links to the Order Resource because the Encounter Resource return a representation of the Order Resource

see original post

it works for encounter also.

it is suboptimal to use it this way though. to have to make two calls one for default and other with full.

just curious. as per the code full representation should have also provided voided info by entering the first if and then entering the second else if. it seems the code was intended that way but is not working like that.

I should have been looking at Order resource which is where the problem is. Full has voided but not in the result. Not sure what is happening.

@petmongrels , i explained that in the above comment

The order Resource was Updated in version 1.10 and the voided property was removed.

@dkayiwa this is what i was asking whether it was intentional to remove the voided field

@dkayiwa , is there some kind of Hibernate filter that filters out Voided order objects of an encounter ?? i cant seem to find it. i