javascript - How to POST multiple observations through REST in OpenMRS -
when sending single observation getting created multiple observations throwing error 500.
for single observations query -
type- post uri - /openmrs-standalone/ws/rest/v1/obs body- { "concept" : "5086aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "person" : "610b0696-7529-4b4a-b65b-37336a75962a", "obsdatetime": "2017-07-24t15:33:49+05:30", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "90" } multiple sending type- post uri - /openmrs-standalone/ws/rest/v1/obs body- [{"concept" : "5089aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "610b0696-7529-4b4a-b65b-37336a75962a", "obsdatetime": "2017-07-24t15:33:49+05:30", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "99" }, { "concept" : "5090aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "person" : "610b0696-7529-4b4a-b65b-37336a75962a", "obsdatetime": "2017-07-24t15:33:49+05:30", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "185" }]
the error here https://pastebin.com/ubajmza9
i found out add observation array, needs packaged inside encounter , request should openmrs should contain headers of authorizaiton:basic = utf8format(username:password) , set-cookie = jsessionid=${sessionid}
the message format should be
{"patient": "${uuid}", "encountertype" : "67a71486-1a54-468f-ac3e-7091a9a79584", "location":"${locationuuid}", "form":"a000cb34-9ec1-4344-a1c8-f692232f6edd", "visit":"${encvisituuid}", "obs":[{"concept" : "5242aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${rr}" }, {"concept" : "5085aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${sysbp}" }, {"concept" : "5086aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${diabp}" }, {"concept" : "5087aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${pulse}" }, {"concept" : "5088aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${t}" }, {"concept" : "5092aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ", "person" : "${uuid}", "encounter": "3bc0672d-ebc6-4e65-aae1-8a1d4de759bf", "value" : "${bo}" }]
}
Comments
Post a Comment