# Hotel API - Search by hotel ID

The API endpoint for this API is: `https://api.makcorps.com/hotelsearch`

### Guide

This API does not require a JWT token because you need your own personal API key to access this API. You can [contact us](https://share.hsforms.com/1A-iwjye2SwWRv4VHhQbBqg439wf) if you need API keys to this API.&#x20;

Here is the list of default parameters you have to use with this API:

|                                                                         |                                                                         |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| <p>hotel\_name<br><br><mark style="color:red;">required</mark></p>      | Name of the hotel. API will still work even if the name is not perfect. |
| <p>hotel\_id<br><br><mark style="color:red;">required</mark></p>        | This is the unique hotel ID provided by our system.                     |
| <p>num\_of\_adults<br><br><mark style="color:red;">required</mark></p>  | It is the number of adults.                                             |
| <p>num\_of\_rooms<br><br><mark style="color:red;">required</mark></p>   | It is the number of rooms.                                              |
| <p>check\_in\_date<br><br><mark style="color:red;">required</mark></p>  | <p>It is the check-in date.<br><br>Format - YYYY-MM-DD</p>              |
| <p>check\_out\_date<br><br><mark style="color:red;">required</mark></p> | <p>It is the check-out date.<br><br>Format - YYYY-MM-DD</p>             |

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://api.makcorps.com/hotelsearch/{hotel_name}/{hotel_id}/{num_of_adults}/{num_of_rooms}/{check_in_date}/{check_out_date}?api_key=YOUR-API-KEY"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://api.makcorps.com/hotelsearch/{hotel_name}/{hotel_id}/{num_of_adults}/{num_of_rooms}/{check_in_date}/{check_out_date}'
api_key = 'YOUR-API-KEY'

url = url.format(
    hotel_name='hotel-name',
    hotel_id='123',
    num_of_adults='2',
    num_of_rooms='1',
    check_in_date='2024-01-01',
    check_out_date='2024-01-02'
)

url_with_api_key = f"{url}?api_key={api_key}"

response = requests.get(url_with_api_key)

# Print the response
print(response.json())

```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
const axios = require('axios');

const url = 'https://api.makcorps.com/hotelsearch/{hotel_name}/{hotel_id}/{num_of_adults}/{num_of_rooms}/{check_in_date}/{check_out_date}';
const apiKey = 'YOUR-API-KEY';

const hotelName = 'hotel-name';
const hotelId = '123';
const numOfAdults = '2';
const numOfRooms = '1';
const checkInDate = '2024-01-01';
const checkOutDate = '2024-01-02';

const formattedUrl = url.replace('{hotel_name}', hotelName)
                        .replace('{hotel_id}', hotelId)
                        .replace('{num_of_adults}', numOfAdults)
                        .replace('{num_of_rooms}', numOfRooms)
                        .replace('{check_in_date}', checkInDate)
                        .replace('{check_out_date}', checkOutDate);

const urlWithApiKey = `${formattedUrl}?api_key=${apiKey}`;

axios.get(urlWithApiKey)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

```

{% endtab %}
{% endtabs %}

### Response

The sample response of the API will look somewhat like this.

```
{
  "comparison": [
    [
      {
        "vendor1": "Expedia.com",
        "price1": "$325",
        "tax1": "$53"
      },
      {
        "vendor2": "Booking.com",
        "price2": "$325",
        "tax2": "$53"
      },
      {
        "vendor3": "Tripadvisor",
        "price3": "$293",
        "tax3": "$48"
      },
      {
        "vendor4": "Hotels.com",
        "price4": "$325",
        "tax4": "$53"
      },
      {
        "vendor5": "Algotels",
        "price5": "$356",
        "tax5": "$90"
      },
      {
        "vendor6": "travelup.com",
        "price6": "$374",
        "tax6": "$88"
      },
      {
        "vendor7": "Orbitz.com",
        "price7": "$325",
        "tax7": "$53"
      },
      {
        "vendor8": "Agoda.com",
        "price8": "$325",
        "tax8": "$53"
      },
      {
        "vendor9": "Trip.com",
        "price9": "$325",
        "tax9": "$53"
      },
      {
        "vendor10": "Travelocity",
        "price10": "$325",
        "tax10": "$53"
      },
      {
        "vendor11": "ZenHotels.com",
        "price11": "$325",
        "tax11": "$74"
      },
      {
        "vendor12": "Vio.com",
        "price12": "$325",
        "tax12": "$53"
      },
      {
        "vendor13": "Priceline",
        "price13": "$325",
        "tax13": "$53"
      },
      {
        "vendor14": "Prestigia.com",
        "price14": "$325",
        "tax14": "$74"
      },
      {
        "vendor15": "StayForLong",
        "price15": "$326",
        "tax15": "$74"
      },
      {
        "vendor16": "Destinia.com",
        "price16": null,
        "tax16": null
      },
      {
        "vendor17": "Official Site",
        "price17": null,
        "tax17": null
      },
      {
        "vendor18": "Skyscanner.com",
        "price18": null,
        "tax18": null
      },
      {
        "vendor19": "SuperTravel",
        "price19": null,
        "tax19": null
      }
    ],
    [
      
    ]
  ]
}
```

### Understand the Response

|        |                                             |
| ------ | ------------------------------------------- |
| vendor | Name of the vendor                          |
| price  | Price offered by the vendor                 |
| tax    | Tax one has to pay while booking this hotel |

{% hint style="info" %}
This one single API call will be counted as 1 API request.
{% endhint %}
