I am trying to save an obs via REST. The requirement is that it should be able to save the concept of a drug, as well as the formulation(that comes from the drug table). An ideal payload would be as follows:
The concept is uuid for “current arv medication” concept.
The value is concept uuid for “Nevirapine” and
The value drug is drug uuid for “Nevirapine 200mg”.
I haven’t been able to save/retrieve this via rest. Any ideas on how I can achieve this via REST?
I’m not sure that what you are trying to do can be done using a single core REST resource (you could create your own in a module). Do you actually need to create the obs as well as the drug order?
Thanks @pascal for the immediate response. I am able to submit obs with simple value and also with value coded. What I am not able to do is view/submit obs with value_drug. I want to be able to do this without using order api i.e. drug order for backward compatibility purpose with existing encounters since I want to be able to edit already saved data, that was saved using either html form entry or the other openmrs data collection modules, that support saving of obs with value_coded and value_drug.
@nkimaina you only need to specify the “value” field using the drug UUID. The REST API will set the concept value_coded for you (see the rest API piece of code that does this). See the required payload below.