Hello, I am trying to post encounter provider but getting an error 400 Bad request. The REST API documentation says that i can create provider using ‘/encounter’ endpoint. I am posting it like this
I am querying the provider using GET call at session and passing it to the scope. The post request fails, I get a error 400 Bad request.
The moment i make POST without encounter provider array, it gets POSTED.
Can someone point out where I am going wrong?
Thanks
I dont really know how do i try to post this on the qa server, because i don’t have encounter or patient uuid right?
Also one more question, can i post any kind of string into any key, as in while posting an encounter if i post {location: “Openmrs”} Will this work, there is no back end logic for accepting values right, or i can post any string to attributes?
From your error log “ConversionException: encounterproviders on class org.openmrs.Encounter” it looks like you are using “encounterproviders” instead of “encounterProviders”
Then it could be that the log you sent is not exactly what happened when at the time of the post. Look for a patient on qa-refapp.openmrs.org and try reproduce it there.
No what i posted, the log is the console.log(response) I get from server after the encounter payload doesn’t gets posted. This is very weird. Will try to reproduce on the qa-refapp.
I am not an openmrs expert and not sure if i did it the right way, but i am getting 400 bad request. But on doing a get call for encounters i can see that encounter provider is being posted when it is selected in the visit from the dropdown.
Am i calling the correct endpoint? /encounter, if i even tried with /encounter/uuid/encounterprovider" but it still doesnt gets posted.
log.txt (18.4 KB)
Can someone have a look at this log? It says column provider_id cannot be null, what could that be?
I am posting provider and it even shows up in console that provider is being sent.
It is done, i just realized i was posting user uuid from /session, which is wrong. I corrected it by querying provider with the user uuid from /session and fetching the provider uuid, and then putting that into the JSON post. And it worked, thanks for the help @dkayiwa and @tendomart