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
status
in the payload when you are updating appointments, as it is reserved for cancelling appointments - all the fields (
start
,end
,resource_id
andcomment
) are optional by default, so you can only provide those you actually want to update; butstart
andend
have 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
start
andend
- we will check that range - if you don't provide
start
andend
- we assume you want to change the resource at the same time slot, and will use currentstart
andend
times of theappointment_id
you are updating
- if you provide
- If you provide
start
andend
, 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_id
of theappointment_id
you are updating
- if you provide
Update Multiple Appointments
That one may be tricky - we encourage you to familiarize with the logic described below well ๐
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
status
in the payload when you are updating appointments, as it is reserved for cancelling appointments - all the fields (
start
,end
,resource_id
andcomment
) are optional by default, so you can only provide those you actually want to update; butstart
andend
have 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
start
andend
- 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_id
for each of the providedids
and 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
start
andend
- we will treat it as a continuous reschedule.
In this case we expect and validate that theids
you provided have the same Patient, Resource, Healthcare Service and Care Unit.
If all of them do - we will check available time slots at providedstart
toend
time range and will fit providedids
to 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 providedstart
toend
range is longer than that covered byids
. We will cancel extra appointments from providedids
, if providedstart
toend
range is shorter that that covered byids
.\
Table of Contents