Add new bed in OpenMRS via REST API


I am trying to add a new bed in OpenMRS via REST API, but constantly I am receiving errors related to a specific field (locationUuid).

Here is how I am trying to add new bed:

curl -X POST "IP:port/openmrs/ws/rest/v1/bed" \

-H "Content-Type: application/json" \

-u superman:Admin123 \

--data-binary @- << EOF

"bedNumber": "304-b",

"bedType": "normal",

"column": 2,

"row": 1,

"locationUuid": "5b86bfe2-f3df-4b99-b13a-b996e9d1196a"


IP and PORT have their respective values

With this JSON I am getting this error :

{"error":{"message":"[not-null property references a null or transient value : org.openmrs.module.bedmanagement.entity.BedLocationMapping.location]","code":"org.hibernate.engine.internal.Nullability:106","detail"

Could you please help me how is the proper way to write a JSON file for this issue?


I resolved this issue, if anyone is dealing with the same issue be careful with locationUuid.

The JSON file is all right, what caused the error is the value I putted on locationUuid, the value should be the locationUuid of the Ward/Room that you want to add new bed.

You can find the correct locationUuid in OpenMRS, Administration --> Location --> Manage Locations --> name of the ward (e.g. General Ward Room 1) --> Uuid (baf83667-d225-11e4-9c67-080027b662ec).