# Hotel API - Search by hotel ID

This API can help you get more than 15 cheapest vendors per hotel. In this API you have to pass the hotel ID. We have our own hotel IDs which you have to map during integration.

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

### Parameters

| Parameter                                                       | Description                                                 |
| --------------------------------------------------------------- | ----------------------------------------------------------- |
| <p>api\_key<br><br><mark style="color:red;">required</mark></p> | Your personal API key.                                      |
| <p>hotelid<br><br><mark style="color:red;">required</mark></p>  | This is the unique hotel ID provided by our system.         |
| <p>adults<br><br><mark style="color:red;">required</mark></p>   | It is the number of adults.                                 |
| <p>cur<br><br><mark style="color:red;">required</mark></p>      | It could be any currency like USD, INR, EUR, etc.           |
| <p>rooms<br><mark style="color:red;">required</mark></p>        | It is the number of rooms.                                  |
| <p>checkin<br><br><mark style="color:red;">required</mark></p>  | <p>It is the check-in date.<br><br>Format - YYYY-MM-DD</p>  |
| <p>checkout<br><br><mark style="color:red;">required</mark></p> | <p>It is the check-out date.<br><br>Format - YYYY-MM-DD</p> |

###

{% hint style="info" %}
To get the ID of the hotel refer to our [Mapping API](https://docs.makcorps.com/mapping-api).
{% endhint %}

### API Example

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

```bash
curl "https://api.makcorps.com/hotel?hotelid=4232686&rooms=1&adults=1&checkin=2023-12-25&checkout=2023-12-26&api_key=6576a85d9769523d73e34228401"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.makcorps.com/hotel"
params = {
    'hotelid': '4232686',
    'rooms': '1',
    'adults': '1',
    'checkin': '2023-12-25',
    'checkout': '2023-12-26',
    'api_key': '6576a85d9769523d73e34228401'
}

response = requests.get(url, params=params)

# Check if the request was successful (status code 200)
if response.status_code == 200:
    # Parse JSON response
    json_data = response.json()
    
    # Print or use the parsed JSON data
    print(json_data)
else:
    # Print an error message if the request was not successful
    print(f"Error: {response.status_code}, {response.text}")

```

{% endtab %}

{% tab title="Nodejs" %}

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

const url = 'https://api.makcorps.com/hotel';
const params = {
    hotelid: '4232686',
    rooms: '1',
    adults: '1',
    checkin: '2023-12-25',
    checkout: '2023-12-26',
    api_key: '6576a85d9769523d73e34228401'
};

axios.get(url, { params })
    .then(response => {
        // Log or process the response data
        console.log(response.data);
    })
    .catch(error => {
        // Log or handle the error
        console.error(`Error: ${error.message}`);
    });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://api.makcorps.com/hotel';
$params = array(
    'hotelid' => '4232686',
    'rooms' => '1',
    'adults' => '1',
    'checkin' => '2023-12-25',
    'checkout' => '2023-12-26',
    'api_key' => '6576a85d9769523d73e34228401'
);

$queryString = http_build_query($params);
$fullUrl = $url . '?' . $queryString;

$response = file_get_contents($fullUrl);

// Check if the request was successful
if ($response !== false) {
    // Parse JSON response
    $json_data = json_decode($response, true);

    // Print or use the parsed JSON data
    print_r($json_data);
} else {
    // Handle the error
    echo "Error: Unable to fetch data.";
}
?>

```

{% endtab %}
{% endtabs %}

### Response

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

```json
{
  "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 %}
