I already use latest REST api module. version: 2.22.0.ba95a3
Are you able to reproduce that problem on this server? http://demo.openmrs.org/
You are supposed to submit to the encounter instead of the obs resource.
I don’t understood.
In your POST url, replace “obs” with “encounter”
Its working now. Thanks
Let me summarize solution:
Encounter end point: /ws/rest/v1/encounter
If you want to submit just encounter, then use this JOSN:
{
"location" : "25b463cb-35d5-41e0-b25b-7c0c0492ef31",
"encounterType": "fef74a7d-706b-461e-a00f-dc907d05f6f2",
"encounterDatetime" : "2018-01-15",
"patient": "61f194c6-36fd-41b4-800d-cb01df3cbf88",
"encounterProviders": [
{
"provider":"457eeb5f-1e7b-4672-b414-16b9e16b7aa4",
"encounterRole": "835ec152-cb27-498a-910c-252cdff6c251"
}
],
"obs" :[
{
"concept" : "bae8ffd2-ee79-494c-abc7-2f2a174f802a",
"value" : "111"
},
{
"concept" : "c201b543-00a3-4f45-b4ee-684e7fe56782",
"value" : "Test"
},
{
"concept" : "b37b9390-f14f-41da-893f-604def748fea",
"value" : "70"
},
{
"concept" : "c28ac81f-eaf2-45ec-b9a2-5ded562d8a91",
"value" : "test."
}
]
}
And If you want to submit html form data just add form UUID with this json. It should looks like:
{
"location" : "25b463cb-35d5-41e0-b25b-7c0c0492ef31",
"encounterType": "fef74a7d-706b-461e-a00f-dc907d05f6f2",
"encounterDatetime" : "2018-01-15",
"patient": "61f194c6-36fd-41b4-800d-cb01df3cbf88",
"form": "99d887fe-b4eb-4813-8001-a7ff2f921007",
"encounterProviders": [
{
"provider":"457eeb5f-1e7b-4672-b414-16b9e16b7aa4",
"encounterRole": "835ec152-cb27-498a-910c-252cdff6c251"
}
],
"obs" :[
{
"concept" : "bae8ffd2-ee79-494c-abc7-2f2a174f802a",
"value" : "111"
},
{
"concept" : "c201b543-00a3-4f45-b4ee-684e7fe56782",
"value" : "Test"
},
{
"concept" : "b37b9390-f14f-41da-893f-604def748fea",
"value" : "70"
},
{
"concept" : "c28ac81f-eaf2-45ec-b9a2-5ded562d8a91",
"value" : "test."
}
]
}
1 Like
Thanks @shahnewaz for sharing!