Cant create a encounter, using provider as param

Hello everyone,

Got a couple questions, i can create an encounter without the provider param. But i cant make on the api with provider due to provider its incorrect

and the error its here (do i have to insert with uuid of Provider or the Person(provider)?? i tryed with both).

Do it passing the provider param it creates a “encounter_provider” on his own??

1 Like

It would help to state the exact url and payload that you are posting to get that stack trace.

i was making a post on “/openmrs/ws/rest/encounter” and my body its on the right side of the image , the 4 are required and provider is opcional

It is better to share the payload in text format.

for example, im making a GET on this uri “/openmrs/ws/rest/v1/encounter/da708aab-5876-4a11-99db-e82f2e0a4b17” and it shows on return a field called encounterProviders that its a empty array…

Im passing on my post to encounter an single object on first post, does this mean the provider field should be an array? the API could get an upgrade, imo

Did you get a chance to look at this?

i tryed , a post to “/openmrs/ws/rest/v1/encounter”, with this body: “{“encounterDatetime”:“2016-11-16 12:08:43”, “patient”:“6a269855-ea8b-4220-b865-c8240c2117ae”, “encounterType”:“d7151f82-c1f3-4152-a605-2f9ea7414a79”, “visit”:“95fa7afc-6cb2-4cef-bae0-9fbf0febe079”, “encounterProviders”:[ { “provider”:“f9badd80-ab76-11e2-9e96-0800200c9a66”, “encounterRole”:“a0b03050-c99b-11e0-9572-0800200c9a66” } ] }”

i think its correct no?

What happened?

its working now !! btw, you know how to make an API POST to create concept with Answers? I discovered that answers are on array, but what is the propety name… ive tried with the uuid like this: … … answers[ {“uuid”:“968a3529-85a8-4a1c-be77-88b5badf0370”} ]

Is this of help?

it does not :frowning: , looking for a example that has a concept with answers but no luck

I think the term answers may have confused you a bit. When submitting obs, we use “value” like in the tests in the link i gave above. If you want to select any of the concept possible answers, when creating an obs, you specify it as “value”.

my problem is that i want on creating a concept

Encounters do not create concepts. They require existing concepts.

i know, thats why i asked you if you know to create a concept some answers through the API

Is this for a unit tests? For end users, you may want to have a look at this:

sorry for the away days,

I want to make some customs forms, that’s why i need the concepts, I’ve already made the “answers” concepts threw the API, but i need to know the “key” word to identify the answers so i could build my concept question, my payload: to switch over the “???” ,

post @ /openmrs/ws/rest/v1/concept

     "????":"162819AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" //concept uuid

That should just be an array of existing concept uuids as you can see here:

you saved my life, big thanks!!! :hugs: