Filtering orders by type through REST API

Hey, presently we use the orders api for storing lab orders. We’re considering making a transition to use orders for drugs as well.

We’d like though to be able to get orders based on their type for a particular patient.

I’ve been testing out the rest API, but I can’t figure out how to get it to let me filter by type. Here’s what I’m using. Any suggestions?

https://ngx.ampath.or.ke/amrs/ws/rest/v1/order?patient=5bac3b9c-1359-11df-a1f1-0026b9348838&orderType=53eb4768-1359-11df-a1f1-0026b9348838

Thanks,

JJ

If you have a straightforward configuration of order types, you can do &t=testorder and &t=drugorder. This will trigger a REST SubclassHandler which corresponds to filtering on OrderType.javaClassName.

If you have a more complex configuration (e.g. Radiology Order and Lab Test Order both use the TestOrder java class under the hood) then I don’t think the REST API lets you filter. (I haven’t looked in the code for this, because I assume it’s not your situation, but if it is, I’ll look.)

Thanks @darius!

I just tested this out (we’re still on RestWS 2.14) and it doesn’t seem to be working properly. Using t=testorder and t=drugorder returns a set of all orders, in this case, we’re testing on a patient with a single testorder. Note that when we change the string, to say t=test, no results are returned.

We are planning to update the module to latest stable release today. We’ll provide an update.

JJ