Module's blog url: https://webkul.com/blog/magento2-rent-appointment-event-hotel-booking-extension/ Graph QL API For Testing can use the application 'Altair GraphQL' :- https://altair.sirmuel.design/ End point : https:///graphql ################# To setup customer authentication follow the steps given below ############################# * Generate customer token Request: mutation { generateCustomerToken(email: "customer_email", password: "customer_password") { token } } Response: { "data": { "generateCustomerToken": { "token": "Generated Token" } } } * Put that customer token in the header of the GraphQL IDE you use (use -> https://altair.sirmuel.design/) NAME | VALUE Authorization | Bearer Note - Make sure to enter required entered and selected options while adding products to cart. Queries 1.Appointment Product BookingInfo Request: query { getAppointmentBookingInfo( productId: ! ) { available availabilityLabel slotDuration booking_available_from booking_available_to location todaySlots{ from to qty } } } Response: { "data": { "getAppointmentBookingInfo": { "available": true "availabilityLabel": "Everyday", "slotDuration": "30", "booking_available_from": "09/16/2022", "booking_available_to": "09/06/2023", "location": "Noida-Greater Noida Expressway, Block C, Ansal Golf Links 1, Greater Noida, Uttar Pradesh, India", "todaySlots": [ { "from": "09:00 am", "to": "12:00 pm", "qty": "1" }, { "from": "06:00 pm", "to": "11:59 pm", "qty": "1" } ] } } } 2.Booking Slots Range in current week Request: query { getWeekBookingSlotData( productId: 56 ! ) { Mon{ from to qty } Tue{ from to qty } Wed{ from to qty } Thu{ from to qty } Fri{ from to qty } Sat{ from to qty } } } Response: { "data": { "getWeekBookingSlotData": { "Mon": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ], "Tue": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ], "Wed": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ], "Thu": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ], "Fri": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ], "Sat": [ { "from": "07:00 am", "to": "01:00 pm", "qty": "100" }, { "from": "02:00 pm", "to": "09:00 pm", "qty": "200" } ] } } } 3.Booking slots info for given date Request: query{ getSlotsInfo( productId: 51 ! date: "2024-10-24" ){ slot_id time qty parent_slot_id } } Response: { "data": { "getSlotsInfo": [ { "slot_id": 21, "time": "11:16 am", "qty": 10, "parent_slot_id": 1 }, { "slot_id": 22, "time": "11:31 am", "qty": 10, "parent_slot_id": 1 }, { "slot_id": 23, "time": "11:46 am", "qty": 10, "parent_slot_id": 1 }, ] } } 4. Check Cancellation of a product Request: query{ checkCancellation( productId: ! ) { cancellationAvail displayCancellation } } Response: { "data": { "checkCancellation": { "cancellationAvail": true, "displayCancellation": true } } } 5. Event Product BookingInfo Request: query{ getEventBookingInfo( productId: 48 ! ){ available location show_map_loction show_contact_button_to product_price event_date_from event_date_to event_chart_available event_chart_image priceRangeFrom priceRangeTo ticket_options{ ticket_id sku is_in_stock price title description qty } } } Response: { "data": { "data": { "getEventBookingInfo": { "available": 1, "location": "Noida-Greater Noida Expressway, Block C, Ansal Golf Links 1, Greater Noida, Uttar Pradesh, India", "show_map_loction": 1, "show_contact_button_to": "Everyone", "product_price": "6", "event_date_from": "15 November, 2023 08:00 am - +0530", "event_date_to": "16 November, 2023 08:14 am - +0530", "event_chart_available": 1, "event_chart_image": "http://192.168.30.147/1magento/magento245/pub/media/advancedbookingsystem/eventChartImage/amazon_prime.png", "priceRangeFrom": 16, "priceRangeTo": 18, "ticket_options": [ { "ticket_id": 1, "sku": "silver", "is_in_stock": 1, "price": "10.000000", "title": "Silver", "description": "Silver Movie Ticket", "qty": 93 }, { "ticket_id": 2, "sku": "gold", "is_in_stock": 1, "price": "12.000000", "title": "Gold", "description": "Gold Movie Ticket", "qty": 101 } ] } } } 6. Rent Product BookingInfo Request: query { getRentBookingInfo( productId:51 !){ available location name sku productPrice bookingAvailableFrom bookingAvailableTo showMapLoction showContactButtonTo rentTypeOptions { rentTypeId title chargePerTxt rentType price } } } Response: { "data": { "getRentBookingInfo": { "available": 1, "location": "Noida-Greater Noida Expressway, Block C, Ansal Golf Links 1, Greater Noida, Uttar Pradesh, India", "name": "Bike Rent", "sku": "Bike Rent", "productPrice": "9", "bookingAvailableFrom": "10/24/2024", "bookingAvailableTo": "10/19/2028", "showMapLoction": 1, "showContactButtonTo": "Logged In Customer", "rentTypeOptions": [ { "rentTypeId": "11", "title": "Daily Basis", "chargePerTxt": "Charged Per Day", "rentType": "d", "price": "100" }, { "rentTypeId": "12", "title": "Hourly Basis", "chargePerTxt": "Charged Per Hour", "rentType": "h", "price": "10" } ] } } } 7. Table Booking Info Request: query { getTableBookingInfo( productId: 52 ! ){ available availabilityLabel location name sku productPrice showMapLoction showContactButtonTo minNoOfGuestsAllowed maxCapacity chargePerLabel chargePerValue slotDuration todaySlots { from to qty } } } Response: { "data": { "getTableBookingInfo": { "available": 1, "availabilityLabel": "Everyday", "location": "Noida, Noida-Greater Noida Expressway, Block C, Ansal Golf Links 1, Greater Noida, Uttar Pradesh, India Uttar Pradesh, IN", "name": "Table Book", "sku": "Table Book", "productPrice": "11", "showMapLoction": 1, "showContactButtonTo": "Everyone", "minNoOfGuestsAllowed": "1", "maxCapacity": "10", "chargePerLabel": "Number of Guests", "chargePerValue": "Guest", "slotDuration": "10", "todaySlots": [ { "from": "12:00 am", "to": "12:00 pm", "qty": null }, { "from": "02:00 pm", "to": "11:59 pm", "qty": null } ] } } } 8. Get Default Booking Slots query{ getDefaultBookingSlots( productId: 47 ! date: "2023-09-06" ! ){ id slot qty day day1 date date_formatted booking_from booking_to } } Response: { "data": { "getDefaultBookingSlots": [ { "id": 1, "slot": "7:00 - 7:10", "qty": 10, "day": "Wednesday", "day1": "Wed", "date": "01-01-1970", "date_formatted": "1,January 1970", "booking_from": "01-01-1970,12:00 am", "booking_to": "01-01-1970,12:00 am" }, { "id": 2, "slot": "7:12 - 7:22", "qty": 10, "day": "Wednesday", "day1": "Wed", "date": "01-01-1970", "date_formatted": "1,January 1970", "booking_from": "01-01-1970,12:00 am", "booking_to": "01-01-1970,12:00 am" }, ] } } 9. Get Hotel Booking Info query{ getHotelBookingInfo( productId: 56 ! ){ available location name sku productPrice showMapLoction askQuesEnable shoNearByMap showContactButtonTo allowedAdults allowedKids maxKidsAge checkInTime checkOutTime } } Response: { "data": { "getHotelBookingInfo": { "available": 1, "location": "Lucknow, Hazrat Ganj Main Road, Hazrat Ganj, VIP Colony, Madhopara, Purnia, Bihar, IndiaUttar Pradesh, IN", "name": "Taj Hotel", "sku": "Taj Hotel", "productPrice": "100", "showMapLoction": 1, "askQuesEnable": 1, "shoNearByMap": 1, "showContactButtonTo": "Everyone", "allowedAdults": "2", "allowedKids": "2", "maxKidsAge": "2", "checkInTime": "09:00 am", "checkOutTime": "10:00 pm", } } } 10. Get HotelAmenities query{ getHotelAmenities( productId:56 ! ){ label imgAvailable imgUrl } } Response: { "data": { "getHotelAmenities": [ { "label": "Parking", "imgAvailable": 1, "imgUrl": "http://localhost/1magento/magento245/pub/media//catalog/product/56/212/86471location.jpeg" }, { "label": "Garden", "imgAvailable": 0, "imgUrl": "" }, ] } } 11. Get Questions List for Hotel Booking Product query{ getQuestionsList( productId: 56 ! questionText: "HI" ){ entity_id question customer_id product_id product_name status nick_name created_at updated_at } } Response: { "data": { "getQuestionsList": [ { "entity_id": 3, "question": "HIzdfsdfds", "customer_id": 0, "product_id": 56, "product_name": "Taj Hotel", "status": 1, "nick_name": "Faizan", "created_at": "2022-10-10 05:19:09", "updated_at": "2022-10-10 05:19:09" }, { "entity_id": 1, "question": "Test Question", "customer_id": 0, "product_id": 56, "product_name": "Taj Hotel", "status": 1, "nick_name": "Faizan", "created_at": "2022-09-07 12:58:45", "updated_at": "2022-09-07 12:58:45" } ] } } 12. Get Answers List for Hotel Booking Product query{ getAnswersList( productId: 56 ! questionId: 3 ! ){ entity_id question_id customer_id status nick_name answer created_at updated_at } } Response: { "data": { "getAnswersList": [ { "entity_id": 1, "question_id": 3, "customer_id": 0, "status": 1, "nick_name": "Test", "answer": "Testing", "created_at": "2022-10-10 07:53:29", "updated_at": "2022-10-10 07:53:29" } ] } } 13. Get Order Items Cancellation Info Request : query { getOrderItemsCancellationInfo( orderUid: "MTYz" ! ){ itemId cancellationAvail cancelled requested } } Response : { "data": { "getOrderItemsCancellationInfo": [ { "itemId": "48", "cancellationAvail": true, "cancelled": true, "requested": true }, { "itemId": "50", "cancellationAvail": true, "cancelled": true, "requested": true } ] } } 14. Get Hotel Booking Configurable Options details and uid Request : query { products(filter: {sku: {eq: "Taj Hotel"} }) { items { ... on HotelBookingProduct { configurable_product_options_selection{ configurable_options{ uid attribute_code values { uid label } } } } } } } Response : { "data": { "products": { "items": [ { "configurable_product_options_selection": { "configurable_options": [ { "uid": "MjU=", "attribute_code": "room_type", "values": [ { "uid": "Y29uZmlndXJhYmxlLzE4My8yMjM=", "label": "Mini Suite" }, { "uid": "Y29uZmlndXJhYmxlLzE4My8yMjQ=", "label": "Queen Suite" }, { "uid": "Y29uZmlndXJhYmxlLzE4My8yMjU=", "label": "King Suite" } ] } ] } } ] } } } 15. Get Table Slots Info Request : query{ getTableSlotsInfo( productId: 34 date: "2023-02-04" ){ slot_id parent_slot_id qty time } } Response : { "data": { "getTableSlotsInfo": [ { "slot_id": 0, "parent_slot_id": 0, "qty": 5, "time": "06:00 am" }, { "slot_id": 1, "parent_slot_id": 0, "qty": 5, "time": "06:35 am" }, { "slot_id": 2, "parent_slot_id": 0, "qty": 5, "time": "07:10 am" }, ] } } 16. Get Product Entered Options for Booking Product Request: query{ products(filter: {sku: {eq: "Movie Ticket"} }) { items { id name sku __typename ... on CustomizableProductInterface { options { title required sort_order uid } } } } } Response : { "data": { "products": { "items": [ { "id": 15, "name": "Movie Ticket", "sku": "Movie Ticket", "__typename": "BookingProduct", "options": [ { "title": "Event Tickets", "required": true, "sort_order": 1, "uid": "Y3VzdG9tLW9wdGlvbi8xNTY=" }, { "title": "Event From", "required": true, "sort_order": 98, "uid": "Y3VzdG9tLW9wdGlvbi8xNzQ=" }, { "title": "Event To", "required": true, "sort_order": 99, "uid": "Y3VzdG9tLW9wdGlvbi8xNzU=" }, { "title": "Event Location", "required": false, "sort_order": 100, "uid": "Y3VzdG9tLW9wdGlvbi8xNzY=" } ] } ] } } } 17. Get Holiday List on a Booking Product Request: query{ getHolidayList( productId: 3 ! ){ date name } } Response: { "data": { "getHolidayList": [ { "date": "2023-04-22", "name": "Eid (Sat, 22 Apr 2023)" }, { "date": "2023-04-25", "name": "Eid Al Adha (Tue, 25 Apr 2023)" } ] } } 18. Check if it is Holiday on Given Date on a Booking Product Request : query{ checkHoliday( productId: 3 ! date: "2024-04-22" ! ) } Response: { "data": { "checkHoliday": false } } Mutations 1. Submit Question Mutation mutation { submitQuestion( productId: 56 ! customerNickname: "Test 1 user" ! userQuestion: "Testing 123" ! ) } Response: { "data": { "submitQuestion": "Your question has been submitted successfully" } } 2. Submit Answer Mutation mutation { submitAnswer( productId: 56 ! questionId: 3 ! customerNickname: "Test 1 user" ! userAnswer: "Testing 123 answer" ! ) } Response: { "data": { "submitAnswer": "Your answer has been submitted successfully" } } 3. Add Table Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Table Booking Products Note - This mutation requires customer authorization mutation { addTableItemToBookingQuote( cartId: "04KERjywBYGAwdsVnQRHvDrsN4i3MwJL" ! cartItemUid: "NjE3" ! bookingDate: "11/01/2022" ! bookingTime: "02:00 pm" ! slotDayIndex: 2 ! slotId: 27 ! parentSlotId: 1 ! ) } Response: { "data": { "addTableItemToBookingQuote": "Item successfully added to Booking Quote." } } 4. Add Appointment Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Appointment Booking Products Note - This mutation requires customer authorization mutation { addAppointmentItemToBookingQuote( cartId: "04KERjywBYGAwdsVnQRHvDrsN4i3MwJL" ! cartItemUid: "NjE3" ! bookingDate: "11/01/2022" ! bookingTime: "02:00 pm" ! slotDayIndex: 2 slotId: 27 parentSlotId: 1 ) } Response: { "data": { "addAppointmentItemToBookingQuote": "Item successfully added to Booking Quote." } } 5. Add Rent Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Rental Booking Products Note - This mutation requires customer authorization mutation { addRentItemToBookingQuote( cartId: "nbNDslsXLgF7owiUrqQu0PgU2nZqrl9k" ! cartItemUid: "NjU5" ! bookingDateFrom: "11/02/2022" ! bookingDateTo: "11/02/2022" bookingFromTimeSlotIndex: 5 bookingToTimeSlotIndex: 6 slotId: 5 slotDayIndex: 3 parentSlotId: 0 ) } Response: { "data": { "addRentItemToBookingQuote": "Item successfully added to Booking Quote." } } 6. Add Event Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Event Booking Products Note - This mutation requires customer authorization mutation { addEventItemToBookingQuote( cartId: "9cadJHmx0CNy0gdN2eepRRlUURPhzqBp" cartItemUid: "OTQw" ! ) } Response: { "data": { "addRentItemToBookingQuote": "Item successfully added to Booking Quote." } } 7. Add Default Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Default Booking Products Note - This mutation requires customer authorization mutation { addDefaultItemToBookingQuote( cartId: "5alqvThYIeDtoL5VnZhrBqWegNaxqzEF" ! cartItemUid: "Njg2" ! bookedQty: 3 ! slotId: 3 ! ) } Response: { "data": { "addDefaultItemToBookingQuote": "Item successfully added to Booking Quote." } } 8. Add Hotel Item To Booking Quote Note - This is a required mutation after addProductsToCart/updateCartItems mutation for Hotel Booking Products Note - This mutation requires customer authorization mutation { addHotelItemToBookingQuote( cartId: "vcw3YDwkf08LifoUyIKAyEYlHiexwOAx" ! cartItemUid: "Nzc0" ! hotelQty: 1 ! ) } Response: { "data": { "addHotelItemToBookingQuote": "Item successfully added to Booking Quote." } } 9. Request Booking Item Cancellation mutation { requestItemCancellation( orderItemId: "12" ! ) } Response: { "data": { "requestItemCancellation": "Cancellation Request Send" } } 10. Sample Query of adding Booking Products to Cart Note - You can get the options value from Product information query Request: mutation { addProductsToCart( cartId: "0ZfiiTNY9jsioFKZjhddYcYBUQ14w3zY" ! cartItems:{ sku: "Movie Ticket", ! quantity: 1, ! entered_options: [ {uid:"Y3VzdG9tLW9wdGlvbi8xNTY=",value:"7"}, {uid:"Y3VzdG9tLW9wdGlvbi8xODE=",value:"15 April, 2023 04:00 pm - IST"}, {uid:"Y3VzdG9tLW9wdGlvbi8xODI=",value:"15 April, 2023 07:03 pm - IST"}, {uid:"Y3VzdG9tLW9wdGlvbi8xODM=",value:"Noida-Greater Noida Expressway, ATS Greens Village, Sector 93A, Noida, Uttar Pradesh, India"}, ] } ){ cart{ items{ uid } } } } Response: { "data": { "addProductsToCart": { "cart": { "items": [ { "uid": "OTQ=" } ] } } } } ! - Required Fileds