Problem with Rest API Appointmentblockwithtimeslot

Application Name: OpenMrs Online Demo Server **Version Number: Question: I am trying to create appointmentBlock with timeslot with following JSON object and following url. /openmrs/ws/rest/v1/appointmentscheduling/appointmentblockwithtimeslot?v=full1

{ “startDate”:“2017-09-27T00:00:00”, “endDate”:“2017-09-27T10:00:00” “location”:“uuid:aff27d58-a15c-49a6-9beb-d30dcfc0c66e”, “types”:[{"uuid:“7dd9ac8e-c436-11e4-a470-82b0ea87e2d8”}], “provider”:“uuid:bb1a7781-7896-40be-aaca-7d1b41d843a6” } It created the appointmentblockwithtime successfully.But I try to used this appointmentblockwithtimeslot uuid in creating appointment with JSON this object. { “timeSlot”: “f2b5e310-9e4b-4530-b1eb-ab1e0133ad06”, “patient”: “c72bdb90-ae11-4ed4-85ac-92c8af1a3452”, “status”: “SCHEDULED”, “appointmentType”: “bb1a7781-7896-40be-aaca-7d1b41d843a6” } I got the following Error. code appointmentscheduling.Appointment.emptyTimeSlot message Empty appointment time slot.

Any other way doing the same thing.

Are you sure that you have a time slot with this uuid? “f2b5e310-9e4b-4530-b1eb-ab1e0133ad06”

yes I am sure.I try several times.

Are you able to reproduce that here?

yes I tried here many times.

Problem is when I create appointmentblockwithtime and try to find it in appointment interface it shows me the created appointmenttimeslot but when I try to used it creating appointment it say’s appointmentslot is empty.Don’t know what happening behind the scene.

Can you show me the steps or urls on this server where i can see the problem in action?

{ “location”: “aff27d58-a15c-49a6-9beb-d30dcfc0c66e”, “startDate”: “2017-08-31T09:00:00.000+0100”, “endDate”: “2017-08-31T17:00:00.000+0100”, “provider”: “f4d6a64f-d996-4367-aa90-559c10db9b91”, “types”: [

{ “uuid”: “7dd9ac8e-c436-11e4-a470-82b0ea87e2d8” } ] }

I created appointmentblockwithtime with this JSON object and following Url. /openmrs/ws/rest/v1/appointmentscheduling/appointmentblockwithtimeslot?v=full

In returned I got the following response

when I try to used response in appointment.It show appointmenttimeslot.empty error

The Logic is first you create a block appointment slot and then you place appointment in that slot. But second step does not work for me. Appointment Object with following Url is: { “timeSlot”: “9c6f2740-ed33-4c60-9d54-d95b3bfd54ec”, “patient”: “c72bdb90-ae11-4ed4-85ac-92c8af1a3452”, “status”: “SCHEDULED”, “appointmentType”: “7dd9ac8e-c436-11e4-a470-82b0ea87e2d8” }

I wrote a lot of this code but it’s been a few years since I’ve looked at it… however, the main uuid returned by the “appointmentblockwithtimeslot” method would be the uuid of the appointmentblock, not the time slot… if you do a GET request on “/openmrs/ws/rest/v1/appointmentscheduling/appointmentblock/{uuid}” I think it should return the appointment block and you’ll see the information, including the uuid, of the timeslot contained in it.

Take care, Mark

Thanks mark you are right that’s the confusion we are trying to solveSo how we can create the timeslot through Rest API as we openmrs create us between dates of appointment block.?

There should be a timeslot resource, I believe… but “appointmentblockwithtimeslot” should create both an appointment block and a time slot, you may just need to run another request to get back the uuid of the timeslot.

Take care, Mark

It does so but when I try to used that slot while creating appointment it say’s appointment slot is empty. Step by Step Procedure. 1.First I create the appointmentblockwithtimeslot it worked. 2.Then I returned appointmenttimeslot by uuid. 3.When try to used in appointment resource it’s how empty slot error.