Create a Booking

This section outlines the endpoint for creating a new booking, including specifying customer and skier details, in the hotel management system.

Create a New Booking

Request:

POST /bookings/ Example usage:

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

Example data:

{
  "customer": {
    "name": "John",
    "surname": "Doe",
    "phone_number": "1234567890",
    "email_adress": "john.doe@example.com"
  },
  "room_id": "101",
  "reservation_id": "Res-12345",
  "hotel_id": "H-6789",
  "check_in_date": "2023-01-01T14:00:00Z",
  "check_out_date": "2023-01-10T11:00:00Z",
  "skiers": [
    {
      "name": "Alice",
      "surname": "Smith",
      "skipass_number": "12-2323-2323112",
      "foot_size": "24",
      "height": "170",
      "age": "30",
      "gender": "Female"
    },
    {
      "name": "Bob",
      "surname": "Johnson",
      "skipass_number": "13-2424-2424113",
      "foot_size": "26",
      "height": "180",
      "age": "35",
      "gender": "Male"
    }
  ]
}

Response:

Content-Type application/json
201 Created / 400 Bad Request

{
  "status": "success" / "error",
  "booking_id": "unique_booking_id" / null,
  "message": null / "Error details if any"
}

Note:

  • Authorization Protected
  • This endpoint is used to create a new booking in the system.
  • The request must include customer and skier details.
  • A 201 Created response is returned upon successful creation of the booking, along with the unique booking ID.
  • If there are any issues with the request, a 400 Bad Request response will be returned, with details about the error.