Obsgroup, once more, using REST

I’ve a grouping obs and would like to create the various obs that make up the group members. Details follow: I’m running openmrs 2.3.0 on a mac, reference app 2.10. I’m able to point the obs_group_id to the grouping obs via api calls but can’t do the same via rest calls. I’m using the following payload for the rest call (http://localhost:8081/openmrs/ws/rest/v1/obs) payload ({ “person”: “3fdffbaf-1e9c-4fa7-b3e9-6fd1ef250920”, “obsDatetime”: “2021-01-25”, “concept”: “5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “location”: “aff27d58-a15c-49a6-9beb-d30dcfc0c66e”, “encounter”: “f06f7a84-56ec-40b7-bfa8-d4c5bf7b692e”, “value”: “290”, “obsGroup”: “34” }) I’ve also tried changing the payload property “obsGroup” with the UUID of the grouping obs, to no avail. Following is the result from the REST call: java.lang.RuntimeException: Failed : HTTP error code : 400

Here’s the pastebin link

Do you mind also sharing the error log or stack trace via pastebin?

I just executed curl, with the same payload, from the command line: curl -u admin:Admin123 -X POST “http://localhost:8081/openmrs/ws/rest/v1/obs” -H “accept: application/json” -H “content-type: application/json” -d “{ “person”: “3fdffbaf-1e9c-4fa7-b3e9-6fd1ef250920”, “obsDatetime”: “2021-01-25”, “concept”: “5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”, “location”: “aff27d58-a15c-49a6-9beb-d30dcfc0c66e”, “encounter”: “f06f7a84-56ec-40b7-bfa8-d4c5bf7b692e”, “value”: “290.0”, “obsGroup”: “3af074ef-50fc-4aee-b2be-a83a9c7ae7b7” }”

Here is the associated pastebin.

Some properties are not allowed to be set: obsGroup

Which means that obsGroup is a read only instead of creatable property.

Use the groupMembers property as seen here: openmrs-module-webservices.rest/EncounterController1_9Test.java at 2.29.0 · openmrs/openmrs-module-webservices.rest · GitHub

Thanks very much…I successfully used curl to set up the obsgroup; also, it worked fine in my module