POST

Customer.Appointments.Add

Create an appointment for the logged-in customer by forwarding to Api::create_doctor_appointment_by_api. Client required fields: appointments_type_id, date, start_time, end_time.

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Customer.Appointments.Add function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • PHP still needs token, branch, and cust_id. The client does not send those. Node fills token (org api_token), cust_id (JWT c_id), and branch (a branch that shares rooms with the appointment type; default_branch is used only if it matches).
  • branch is optional for this App API. Send it only to override. If omitted, Node tries matching branches until PHP succeeds. Alias: appointment_branch_id.
  • "No doctor or room found for this user!" means PHP found no overlapping appointment_room between the branch and appointments_type_id. Assign the same rooms to both in the dashboard, or send a branch that already shares rooms with that type.
  • doctor_id is optional. If sent, it is kept as-is (not replaced by another doctor). The doctor must be assigned to that appointments_type_id (branch_doctor_id / doctor_id), same as dashboard and get_available_appointment. If not, response is: This doctor does not handle this type of appointment. Alias: team_member_id.
  • If doctor_id is omitted, Node/PHP auto-picks a doctor from branch n type.
  • Does not change staff Calendar.Add dashboard UI.

Required Parameters

NameTypeSampleExplanation
appointments_type_id
post
int699Required. doctor_appointments_type.id. Aliases: appointments_type_data_id, appointment_type_id.
start_time
post
string06:30Required. H:i. Must be before end_time unless end_time is 00:00.
end_time
post
string06:40Required. H:i.
date
post
date2026-04-29Required. Y-m-d or DD/MM/YYYY. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part.

Optional Parameters

NameTypeSampleWhat it gives
branch
post
int38Optional. PHP needs a branch, but Node fills it. Override with branches.id if needed. Alias: appointment_branch_id.
doctor_id
post
int22286Optional. Team member id. Kept when sent; must be on the appointment type. Alias: team_member_id.
appointment_room_id
post
int12Optional. PHP overwrites this with the next free room from branch n type.
patient_name
post
stringJaneOptional. Defaults to contactus.name.
lang
post
stringenOptional. PHP language file. Default en.

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Customer.Appointments.Add",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "start_time": "06:30",
        "end_time": "06:40",
        "date": "2026-04-29",
        "appointments_type_id": "699",
        "doctor_id": "22286"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Customer.Appointments.Add",
    "url_domain": "https:\/\/{domain}\/app\/Customer.Appointments.Add"
}

Endpoint

POST /app/Customer.Appointments.Add
POST https://{user}.bull36.com/app/Customer.Appointments.Add
POST https://{domain}/app/Customer.Appointments.Add

Sample Output

{
    "success": 1,
    "insert_id": 901,
    "message": "Appointment add successfully"
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('start_time', '06:30');
body.set('end_time', '06:40');
body.set('date', '2026-04-29');
body.set('appointments_type_id', '699');
body.set('doctor_id', '22286');

const res = await fetch('/app/Customer.Appointments.Add', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body
});
const data = await res.json();
console.log(data);

Error Example

{
    "success": 0,
    "message": "This doctor does not handle this type of appointment."
}