The Appointments resource handles the full lifecycle of a patient’s booking. AMS reads all existing records on launch withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Jay-byte389/AMS/llms.txt
Use this file to discover all available pages before exploring further.
GET /Appointments, writes a new booking with POST /Appointments when the patient submits the schedule form, and updates a record’s status field to "Cancelled" via PUT /Appointments/:id when the patient cancels. All three operations are performed through the shared Axios client in src/services/api.js and are exposed to the UI through Redux Toolkit async thunks.
GET /Appointments
Method: GET — Path:
/AppointmentsService Function
Defined insrc/services/appointmentApi.js:
src/services/appointmentApi.js
Redux Thunk
fetchAppointments wraps fetchAppointmentsFromApi and stores the result in state.appointments.list. Defined in src/redux/thunk/appointmentThunk.js:
src/redux/thunk/appointmentThunk.js
Request Parameters
No parameters are accepted. The endpoint always returns the full appointments collection.Response
Returns a JSON array of appointment objects.Appointment Object Schema
Unique appointment identifier assigned by MockAPI on creation.
Identifies the patient who booked the appointment. Set to the logged-in user’s
email or mobile number — whichever is available — or "guest" if neither is present.Indicates whether the appointment is for the account holder or someone else. One of
"Yourself" or "Another Person".Full name of the patient as entered in the Patient Details form on the Schedule screen.
Age of the patient as entered in the form (stored as a string).
Gender selected on the Schedule screen. One of
"Male", "Female", or "Other".Free-text description of the patient’s medical issue as entered in the Describe your problem field.
Full month name of the appointment (e.g.
"January", "February"). Used together with appointmentDay to group appointments by date.Numeric day of the month (e.g.
15). Combined with appointmentMonth for date filtering in the Home and DoctorInfo screens.Abbreviated weekday name derived from the week selector (e.g.
"Mon", "Tue").Selected time slot in 12-hour format (e.g.
"10:00 AM", "2:30 PM"). Used to detect booking conflicts and sort upcoming appointments.ISO 8601 date string for the appointment (e.g.
"2025-07-15"). Sourced from the calendar’s dateString property.Foreign key referencing the doctor’s
id in the /Doctors resource.URL of the doctor’s avatar image, copied from the doctor record at booking time.
Doctor’s full name copied from the doctor record at booking time.
Doctor’s department or speciality copied from the doctor record. Falls back to
doctor.qualification if department is absent.Doctor’s qualification abbreviation (e.g.
"MBBS") copied from the doctor record.Current appointment status. One of
"Upcoming" or "Cancelled". New appointments are always created with "Upcoming"; the cancelAppointment thunk updates this to "Cancelled".ISO 8601 timestamp of when the appointment was booked (e.g.
"2025-07-10T08:45:00.000Z"). Set client-side via new Date().toISOString() at the moment of submission.Example Response
POST /Appointments
Method: POST — Path:
/Appointmentsid which is immediately pushed into the Redux appointments.list array.
Service Function
Defined insrc/services/appointmentApi.js:
src/services/appointmentApi.js
Redux Thunk
addAppointment wraps createAppointmentOnApi. On success, the returned object (with its MockAPI-assigned id) is appended to state.appointments.list. Defined in src/redux/thunk/appointmentThunk.js:
src/redux/thunk/appointmentThunk.js
Request Body
Send a JSON object containing all appointment fields. MockAPI assigns theid and returns it in the response — do not include id in the request body.
Response
Returns the newly created appointment object with the server-assignedid included.
Usage Example
The Schedule screen builds the payload and dispatchesaddAppointment:
src/screens/ScheduleScreen.jsx
PUT /Appointments/:id
Method: PUT — Path:
/Appointments/:idstatus to "Cancelled". The full appointment object (including all original fields) is sent in the request body with the status field overwritten.
Service Function
Defined insrc/services/appointmentApi.js:
src/services/appointmentApi.js
Redux Thunk — cancelAppointment
The cancelAppointment thunk accepts the full existing appointment object, spreads all its fields into a new object, overrides status to "Cancelled", and passes the result to updateAppointmentOnApi. Defined in src/redux/thunk/appointmentThunk.js:
src/redux/thunk/appointmentThunk.js
...appointment) ensures every original field is preserved on the MockAPI record. Only status is changed; all other fields remain unchanged.
Path Parameter
The
id of the appointment record to update. This value is present on every object returned by GET /Appointments and POST /Appointments.Request Body
The complete appointment object withstatus set to "Cancelled". All fields from the original record must be included since MockAPI replaces the entire document.
Response
Returns the updated appointment object withstatus: "Cancelled".
Example: Cancel an Appointment
After a successful cancellation, the
cancelAppointment.fulfilled reducer filters the cancelled appointment out of state.appointments.list by id, so the UI updates immediately without a refetch.