Update a Booking

This section explains the endpoint for updating an existing booking, including modifying customer and skier details, in the hotel management system.

Update an Existing Booking

Request:

PUT /bookings/{booking_id}/ Example usage:

curl -X PUT http://exampledomain.com/api/v1/bookings/12345/ \
    -H "Content-Type: application/json" \
    -H "Authorization: Token YOUR_ACCESS_TOKEN" \
    -d @data.json

Example data:

{
  "customer": {
    "name": "Updated Name",
    "surname": "Updated Surname",
    "phone_number": "updated_phone_number",
    "email_adress": "updated_email@example.com"
  },
  "room_id": "updated_room_id",
  "reservation_id": "updated_reservation_id",
  "hotel_id": "updated_hotel_id",
  "check_in_date": "updated_check_in_date",
  "check_out_date": "updated_check_out_date",
  "skiers": [
    // Updated skier details...
  ]
}

Parameters:

  • booking_id - The unique identifier of the booking to be updated.

Response:

Content-Type application/json
200 OK / 400 Bad Request / 404 Not Found

{
  "status": "success" / "error",
  "booking_id": "unique_booking_id",
  "message": "Booking updated successfully" / "Error details if any",
  "data": {
    // Updated booking details...
  }
}

Note:

  • Authorization Protected
  • This endpoint updates the booking specified by the booking_id.
  • A 200 OK response is returned upon successful update, along with updated booking details.
  • If the booking does not exist, a 404 Not Found response will be returned.
  • If there are any issues with the request or the update process, a 400 Bad Request response will be returned, with details about the error.