The OpenMRS Rest Web Service and Order Entry UI Application

    As a developer working on the Order Entry UI Application, there'll be times where you'll need to interface with the OpenMRS RESTful API, this document outlines few tips on how to go about consuming the OpenMRS REST WEB Service Resource when creating and updating a resource on the API.

CREATING ORDERS

   To create orders on the REST resource. The endpoint used to create orders is the encounter resource, A typical request to the encounter resource has already been made to create lab and drug orders in the project, documentation of the required properties when creating a rest resource can be found here.

MODIFYING THE ORDER RESOURCE

    It is key to know that the API does not work with the PUT http request method, so to update an already created resource, the API should be sent a similar request payload with all the current properties of the order against the encounter resource just as it's done when creating orders.but the action property in the order object should be set to REVISE. the previousOrder property should also be set to the current uuid of the order to be edited.

NB: note that the api would send back a data containing an order with the previous details but a new id.

 not having the knowledge above on editing a resource was a blocker that took some time for me to resolve, the document below provides more information on how to work with the API

REST Web Services API For Clients