Update Appointment(s)
Update Appointment(s)
Updating is done via our PATCH Appointments endpoints.
Update Single Appointment
If you want to update a single appointment, use PATCH Appointment endpoint, passing appointment_id as the path parameter, and including fields you would like to update in JSON body payload:
curl --location --request PATCH 'https://api.leyr.io/api/emrs/{emr}/appointments/{appointment_id}'
--header 'x-leyr-client-id: {x-leyr-client-id}'
--header 'x-leyr-client-secret: {x-leyr-client-secret}'
--header 'x-leyr-standard: {x-leyr-standard}'
--data-raw '{
"start": {start},
"end": {end},
"resource_id": {resource_id},
"comment": {comment}
}'
Parameters validation
- please do not provide
statusin the payload when you are updating appointments, as it is reserved for cancelling appointments - all the fields (
start,end,resource_idandcomment) are optional by default, so you can only provide those you actually want to update; butstartandendhave to be provided together
What Leyr does for you?
- If you provide
resource_id, we will check that there are time slots available for selected Resource:- if you provide
startandend- we will check that range - if you don't provide
startandend- we assume you want to change the resource at the same time slot, and will use currentstartandendtimes of theappointment_idyou are updating
- if you provide
- If you provide
startandend, we will check that there are time slots available for selected time range:- if you provide
resource_id- we will check for that Resource - if you don't provide
resource_id- we assume you want to reschedule an appointment with the same Resource, and will use currentresource_idof theappointment_idyou are updating
- if you provide
Update Multiple Appointments
If you want to update multiple appointments at once, doing bulk cancel, use our PATCH Appointments. In that case you no longer pass appointment_id in path parameters. Instead, you pass ids in array in JSON body payload, together with the fields you would like to update:
curl --location --request PATCH 'https://api.leyr.io/api/emrs/{emr}/appointments'
--header 'x-leyr-client-id: {x-leyr-client-id}'
--header 'x-leyr-client-secret: {x-leyr-client-secret}'
--header 'x-leyr-standard: {x-leyr-standard}'
--data-raw '{
"ids": ["appointment_id_1", "appointment_id_2", "appointment_id_3"],
"start": {start},
"end": {end},
"resource_id": {resource_id},
"comment": {comment}
}'
Parameters validation
- please do not provide
statusin the payload when you are updating appointments, as it is reserved for cancelling appointments - all the fields (
start,end,resource_idandcomment) are optional by default, so you can only provide those you actually want to update; butstartandendhave to be provided together
What Leyr does for you?
We treat bulk update endpoint in two different "scenarios", based on if you provide start and end parameters or not
- if you do not provide
startandend- we will treat it as pure bulk update:- if you provide
resource_id- we will validate if there is a time slot available with providedresource_idfor each of the providedidsand move all of them to that Resource. If one of the appointments cannot be moved (there is no time slots available) - we will return a BAD_REQUEST response.
- if you provide
- if you do provide
startandend- we will treat it as a continuous reschedule.
In this case we expect and validate that theidsyou provided have the same Patient, Resource, Healthcare Service and Care Unit.
If all of them do - we will check available time slots at providedstarttoendtime range and will fit providedidsto those time slots.
That means we will re-use as many appointments as possible, rescheduling them in the new time slots. We will create new appointments with the same Patient, Resource, Healthcare Service and Care Unit, if providedstarttoendrange is longer than that covered byids. We will cancel extra appointments from providedids, if providedstarttoendrange is shorter that that covered byids.\
Cancel Appointment(s)
Cancelling is done via our PATCH Appointments endpoints.
Confirm Appointments
In some cases, Leyr will now prompt you to confirm an appointment that was requested (created via POST Appointments endpoint). You can now use our PATCH Appointments endpoint to confirm such appointments.