Magetop Booking Extension REST API

Magetop Booking Extension is fully integrated with the Magento REST API. This allows Bookings data to be read using requests in JSON format and using Magento REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.

1. Get Per Day and Per Night Price 

Url: V1/bookingonline/bookingsimple

Method: POST

Param:

{
  "book_product_id": 6,
  "book_type": "per_day",
  "product": 6,
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "19/01/2021",
  "end_date": "22/01/2021",
  "qty": 1,
}

Response:

{
  "status": "success",
  "message": "check price success",
  "price_detail": {
    "status": "success",
    "message": "Item is available , you can see detail bellow: ",
    "price": 400,
    "promo": 320,
    "save_money": 80,
    "save_percent": 20,
    "start_date": "19/01/2021",
    "end_date": "22/01/2021",
    "total_days": 4,
    "select_options": 0
  }
}

2. Get Time Slots 

Url: V1/bookingonline/gettimeslots

Method: POST

Param: 

{
  "product": 1,
  "book_product_id": 1,
  "book_type": "per_time",
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "13/01/2021",
  "end_date": "13/01/2021",
  "qty": 1,
  "book_is_ticket": 2,
  "book_ticket_seat": "",
  "max_book_number": 0,
  "tmp_slot_slot_id": 0,
  "is_book_load": 1,
  "time_slots": [],
}

Response:

{
  "status": "success",
  "time_slots": [
    {
      "slot_id": "183",
      "status": "available",
      "text": "08:00 50 Available",
      "hours_start": "08:00",
      "hours_end": "09:00",
      "qty": 50
    },
    {
      "slot_id": "184",
      "status": "available",
      "text": "09:00 50 Available",
      "hours_start": "09:00",
      "hours_end": "11:00",
      "qty": 50
    }
  ]
}

3. Get Time Slot Price

Url: V1/bookingonline/booktimeslot

Method: POST

Param: 

{
  "product": 1,
  "book_product_id": 1,
  "book_type": "per_time",
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "13/01/2021",
  "end_date": "13/01/2021",
  "qty": 1,
  "book_is_ticket": 2,
  "book_ticket_seat": "",
  "max_book_number": 0,
  "tmp_slot_slot_id": 0,
  "is_book_load": 1,
  "time_slots": [
    "183",
    "184"
  ],
}

Response:

{
  "status": "success",
  "message": "check price success",
  "price_detail": {
    "status": "success",
    "message": "Item is available , you can see detail bellow: ",
    "price": 340,
    "promo": 300,
    "total_time_slot": 2,
    "save_money": 40,
    "save_percent": 12,
    "slot_quy": "50",
    "row_number": 5,
    "start_date": "13/01/2021",
    "total_days": 1,
    "select_options": [],
    "time_slot_labels": [
      "08:00",
      "09:00"
    ],
    "cart_seat": "",
    "cur_seat": ""
  }
}

4. Get List Hours

Url: V1/bookingonline/gettimeslots

Method: POST

Param: 

{
  "product": 11,
  "book_product_id": 11,
  "book_type": "per_hour",
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "20/01/2021",
  "end_date": "20/01/2021",
  "qty": 1,
  "book_is_ticket": 2,
  "book_ticket_seat": "",
  "max_book_number": 0,
  "tmp_slot_slot_id": 0,
  "is_book_load": 1,
  "time_slots": [],
  "start_hours": "",
  "end_hours": "",
}

Response:

{
  "status": "success",
  "time_slots": [
    {
      "slot_id": "168",
      "status": "available",
      "text": "14:00 100 Available",
      "hours_start": "14:00",
      "hours_end": "15:00",
      "qty": 100
    },
    {
      "slot_id": "169",
      "status": "available",
      "text": "15:00 100 Available",
      "hours_start": "15:00",
      "hours_end": "16:00",
      "qty": 100
    },
    {
      "slot_id": "170",
      "status": "available",
      "text": "16:00 100 Available",
      "hours_start": "16:00",
      "hours_end": "17:00",
      "qty": 100
    },
    {
      "slot_id": "171",
      "status": "available",
      "text": "17:00 100 Available",
      "hours_start": "17:00",
      "hours_end": "18:00",
      "qty": 100
    },
    {
      "slot_id": "172",
      "status": "available",
      "text": "18:00 100 Available",
      "hours_start": "18:00",
      "hours_end": "19:00",
      "qty": 100
    },
    {
      "slot_id": "173",
      "status": "available",
      "text": "19:00 100 Available",
      "hours_start": "19:00",
      "hours_end": "20:00",
      "qty": 100
    },
    {
      "slot_id": "174",
      "status": "available",
      "text": "20:00 100 Available",
      "hours_start": "20:00",
      "hours_end": "21:00",
      "qty": 100
    }
  ]
}

5. Get Hour Price

Url: V1/bookingonline/booktimeslot

Method: POST

Param: 

{
'cartItem':  {
'sku': product_sku,
'qty': qty,
'quote_id'=>quoteId
},
mobi_booking_params: {

}
}

Response:

{
'status'=>'success',
'message'=>'you have add product to cart success'
}

6. Get List Rooms

Url: V1/bookingonline/listrooms

Method: POST

Param: 

{
  "hotel_id": 12,
  "product": 12,
  "book_product_id": 12,
  "book_type": "hotel",
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "18/01/2021",
  "end_date": "21/01/2021",
  "qty": 1,
  "room_id": "0"
}

Response:

{
  "status": "success",
  "message": "get room success",
  "list_rooms": [
    {
      "room": {
        "room_id": "1",
        "status": "1",
        "room_type": "Meting",
        "max_adults": "200",
        "max_children": "80",
        "position": "0",
        "hotel_id": "12",
        "minimum_day": "0",
        "maximum_day": "0",
        "description": "200 Adult, 80 Children",
        "created_at": "0000-00-00 00:00:00",
        "updated_at": "0000-00-00 00:00:00",
        "max_infant": "0"
      },
      "price_detail": {
        "status": "success",
        "message": "Item is available , you can see detail bellow: ",
        "price": 1200,
        "promo": 800,
        "save_money": 400,
        "save_percent": 33,
        "child_price": 0,
        "infant_price": 0,
        "child_promo": 0,
        "infant_promo": 0,
        "total_price": 1200,
        "start_date": "2021-01-18",
        "end_date": "2021-01-21",
        "total_days": 4,
        "book_version": 1,
        "select_options": 0,
        "total_promo": 800
      }
    },
    {
      "room": {
        "room_id": "2",
        "status": "1",
        "room_type": "Family",
        "max_adults": "2",
        "max_children": "2",
        "position": "0",
        "hotel_id": "12",
        "minimum_day": "0",
        "maximum_day": "0",
        "description": "2 Adults, 2 Children, 2 infant",
        "created_at": "0000-00-00 00:00:00",
        "updated_at": "0000-00-00 00:00:00",
        "max_infant": "2"
      },
      "price_detail": {
        "status": "success",
        "message": "Item is available , you can see detail bellow: ",
        "price": 400,
        "promo": 0,
        "save_money": 0,
        "save_percent": 0,
        "child_price": 0,
        "infant_price": 0,
        "child_promo": 0,
        "infant_promo": 0,
        "total_price": 400,
        "start_date": "2021-01-18",
        "end_date": "2021-01-21",
        "total_days": 4,
        "book_version": 1,
        "select_options": 0,
        "total_promo": 0
      }
    }
  ]
}

7. Get List Room Price

Url: V1/bookingonline/listrooms

Method: POST

Param: 

{
  "hotel_id": 12,
  "product": 12,
  "book_product_id": 12,
  "book_type": "hotel",
  "long_format_date": "DD/MM/YYYY",
  "book_sale_id": 0,
  "book_date": "",
  "start_date": "18/01/2021",
  "end_date": "21/01/2021",
  "qty": 1,
  "room_id": "1"
}

Response:

{
  "status": "success",
  "message": "check price success",
  "price_detail": {
    "status": "success",
    "message": "Item is available , you can see detail bellow: ",
    "price": 1200,
    "promo": 800,
    "save_money": 400,
    "save_percent": 33,
    "child_price": 0,
    "infant_price": 0,
    "child_promo": 0,
    "infant_promo": 0,
    "total_price": 1200,
    "start_date": "18/01/2021",
    "end_date": "21/01/2021",
    "total_days": 4,
    "book_version": 1,
    "select_options": 0,
    "total_promo": 800
  }
}

8. Add Booking Product to Cart

Url: V1/carts/mine/items

Method: POST

Param: 

{
  "cartItem": {
    "sku": 12,
    "qty": 12,
    "quote_id": 12,
  },
   "mobi_booking_params": {
  }
}

Response:

{
  "status": "success",
  "message": "You have added product to cart success",
  "item_id": 214
}

9. Add Booking Product Data

Url: V1/products/sku

Method: GET

Response:

{
  "product": {
    "id": 12,
    "sku": "Concordo Hotel New York",
    "name": "Concordo Hotel New York",
    "attribute_set_id": 4,
    "price": 100,
    "status": 1,
    "visibility": 4,
    "type_id": "bookingonline",
    "created_at": "2020-12-18 00:23:21",
    "updated_at": "2020-12-30 07:41:04",
    "extension_attributes": {
      "website_ids": [
        1
      ],
      "category_links": [
        {
          "position": 0,
          "category_id": "2"
        },
        {
          "position": 0,
          "category_id": "6"
        }
      ],
      "mobi_booking_data": [
        "{\"book_id\":\"31\",\"book_type\":\"hotel\",\"book_product_id\":\"12\",\"min_days\":\"0\",\"min_hours\":\"0\",\"amount_hours\":\"0\",\"start_time\":null,\"end_time\":null,\"show_end_time\":\"2\",\"show_qty\":\"2\",\"tour_type\":\"1\",\"tour_default_day\":\"0\",\"max_adult\":\"0\",\"max_child\":\"0\",\"max_infant\":\"0\",\"store_id\":\"0\",\"book_version\":\"0\",\"is_default\":\"1\",\"disable_days\":null,\"book_phone\":\"+120023232\",\"book_email\":\"[email protected]\",\"book_city\":\"New York\",\"book_zip_code\":\"07039\",\"book_country\":\"US\",\"book_state\":\"New Jersey\",\"book_state_id\":\"41\",\"book_address\":\"290 W Mt Pleasant Ave, Livingston\",\"book_lat\":\"37.33496283053613\",\"book_lng\":\"-122.01346009748384\",\"book_address_auto\":\"1 Apple Park Way, Cupertino, CA, USA\",\"created_at\":\"0000-00-00 00:00:00\",\"updated_at\":\"0000-00-00 00:00:00\",\"group_ids\":null,\"is_ticket\":\"2\",\"book_gate\":null}"
      ]
    },
    "product_links": [],
    "options": [],
    "media_gallery_entries": [
      {
        "id": 15,
        "media_type": "image",
        "label": null,
        "position": 3,
        "disabled": false,
        "types": [
          "image",
          "small_image",
          "thumbnail"
        ],
        "file": "/c/o/concorde-hotel-new-york_1_1_.jpg"
      },
      {
        "id": 16,
        "media_type": "image",
        "label": null,
        "position": 4,
        "disabled": false,
        "types": [],
        "file": "/c/o/concorde-hotel-new-york_1__1_1_.jpg"
      }
    ],
    "tier_prices": [],
    "custom_attributes": [
      {
        "attribute_code": "thumbnail",
        "value": "https://stage.maiuoc.com/bookingapp/pub/media/catalog/product/cache/c6179f3238023d15485a08b819dffda5/c/o/concorde-hotel-new-york_1_1_.jpg"
      },
      {
        "attribute_code": "image",
        "value": "/c/o/concorde-hotel-new-york_1_1_.jpg"
      },
      {
        "attribute_code": "small_image",
        "value": "/c/o/concorde-hotel-new-york_1_1_.jpg"
      },
      {
        "attribute_code": "options_container",
        "value": "container2"
      },
      {
        "attribute_code": "url_key",
        "value": "new-york-hotel"
      },
      {
        "attribute_code": "gift_message_available",
        "value": "2"
      },
      {
        "attribute_code": "required_options",
        "value": "0"
      },
      {
        "attribute_code": "has_options",
        "value": "0"
      },
      {
        "attribute_code": "meta_title",
        "value": "new york hotel"
      },
      {
        "attribute_code": "meta_keyword",
        "value": "new york hotel"
      },
      {
        "attribute_code": "meta_description",
        "value": "new york hotel "
      },
      {
        "attribute_code": "tax_class_id",
        "value": "2"
      },
      {
        "attribute_code": "category_ids",
        "value": [
          "2",
          "6"
        ]
      }
    ]
  }
}

This is the end of the Magetop Booking Extension REST API.

Follow us for the more helpful posts!

We hope this is a useful post for you.

Thank you for reading!

4.7 3 votes
Article Rating

Mai Uoc

CTO and Founder of Magetop, Magento Full-Stack Developer, Leader of Booking Team, Product Designer Team & Mobile App Team with over 8 years experience of working with Magento and clients all over the world.

Leave a Reply or put your Question here

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x