Issue making a post request to create a test-order order-type

Hi everyone,

I am currently working on a JIRA issue that involves making a post request to the /order api endpoint to create a new test-order resource on the system and I have been experiencing some difficulties. The current issue I am experiencing is that the server responds with a status code of 400(client side error) with a fieldError message;


encounter cannot be null or empty


I am guessing it has to do with the id I am trying to use to create it because if I remove the encounter field, I get a different error message, but If I change the type in the request payload to drugorder, it works, and that makes it a little more confusing. please I would love to hear ideas on how I could resolve this blocker.

Caan you give the detailed log at plus how can we reproduce the error ?

Also it would be helpful to point us to the JIRA ticket.

To reproduce the error; just make a POST request to the /order rest resource endpoint with a request payload of the following,

encounter: ENCOUTER_UUID
type: 'testorder'

@tendomart , I’m not sure I can give a detailed log now, I’m currently working on an alternative now.

Can you please share the alternative you are working on @efosa

The current alternative I am working on is to use the order-type resource to save the lab-order data for now. this is the link to the JIRA ticket

Can we create a ticket in the REST WS module for this bug? The minimum steps you have to reproduce are fine for now?

When you create the ticket, flag me, and I will see if there’s an easy fix… yes, this is definitely a blocker we should fix ASAP, as saving an order by putting it’s JSON rep within the description field of an order-type is definitely not a sustainable solution! :slight_smile:

Thanks, Mark

fyi @efosa @tunmi

thanks for the response @mogoodrich , It would also be better if there is another resource for handling lab-order just as there is for drug-order, I’ll notify you once I create the ticket.

@efosa ah, thanks for the clarification… I should have thought of this earlier, but there is a test order resource, which is what lab orders fall under, so you’d want to be posting to this endpoint:

It still seems strange, however, that you’d be getting an error around encounter, because Order, DrugOrder and TestOrder should all support encounters. How are you creating the encounter to link the order to?

Take care, Mark

For the sake of clarity, I currently post to the /order endpoint and I specify the type in the request payload as test order, I believe that should make the endpoint you are referring to handle the request. is there anything you think I am doing wrong that way? @mogoodrich

Sorry, my mistake, @efosa! I thought that there would be a specific “testorder” endpoint, but it looks like you are correct, I believe you post to the /order endpoint with the type “testorder”. Sorry for the confusion!

Give me a heads up when you create the ticket and I can explore further!

Take care, Mark

I have created the ticket. click here for details

Thanks @efosa! I will take a look, hopefully later today.

Take care, Mark

Hi everyone,

This blocker has been resolved, Thanks to Daniel Kayiwa for taking out time to help. Thanks, everyone.

My regards, Efosa

cc @mogoodrich @tunmi @tendomart @topseysuave @jeiddiah @rhenshaw56

1 Like

Awesome, thanks @efosa and @dkayiwa!

Take care, Mark