💻
Hotel API - Search by City Name
In a single API request to this API will return all the hotels in a city with top 4 cheapest vendors.
API endpoint for this API is:
https://api.makcorps.com/citysearch
This API does not require a JWT token because you need your own personal API key to access this API. You can contact us if you need API keys to this API.
Here is the list of default parameters you have to use with this API:
Parameters | Description |
---|---|
cityname
required | Name of the city |
page
required | It is a page number. It starts with 0 and each page will provide you with 30 hotels. |
currency
required | It could be any currency like USD, INR, EUR, etc. |
num_of_rooms
required | It is the number of rooms. |
num_of_adults
required | It is the number of adults. |
check_in_date
required | It is the check-in date.
Format - YYYY-MM-DD |
check_out_date
required | It is the check-out date.
Format - YYYY-MM-DD |
cURL
Python
Nodejs
curl -X GET "https://api.makcorps.com/citysearch/{cityname}/{page}/{currency}/{num_of_rooms}/{num_of_adults}/{check_in_date}/{check_out_date}?api_key=YOUR-API-KEY"
import requests
url = 'https://api.makcorps.com/citysearch/{cityname}/{page}/{currency}/{num_of_rooms}/{num_of_adults}/{check_in_date}/{check_out_date}'
api_key = 'YOUR-API-KEY'
url = url.format(
cityname='London',
page='0',
currency='USD',
num_of_rooms='1',
num_of_adults='3',
check_in_date='2023-10-03',
check_out_date='2023-10-04'
)
url_with_api_key = f"{url}?api_key={api_key}"
response = requests.get(url_with_api_key)
# Print the response
print(response.json())
const axios = require('axios');
const url = 'https://api.makcorps.com/citysearch/{cityname}/{page}/{currency}/{num_of_rooms}/{num_of_adults}/{check_in_date}/{check_out_date}';
const apiKey = 'YOUR-API-KEY';
const cityname = 'London';
const page = '0';
const currency = 'USD';
const num_of_rooms = '1';
const num_of_adults = '3';
const check_in_date = '2023-10-03';
const check_out_date = '2023-10-04';
const formattedUrl = url
.replace('{cityname}', cityname)
.replace('{page}', page)
.replace('{currency}', currency)
.replace('{num_of_rooms}', num_of_rooms)
.replace('{num_of_adults}', num_of_adults)
.replace('{check_in_date}', check_in_date)
.replace('{check_out_date}', check_out_date);
const urlWithApiKey = `${formattedUrl}?api_key=${apiKey}`;
axios
.get(urlWithApiKey)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
The sample response of the API will look somewhat like this.
{
"hotelName": "Hilton London Paddington",
"hotelId": "209371"
},
[
{
"price1": "279",
"tax1": "70",
"vendor1": "Prestigia.com"
},
{
"price2": "253",
"tax2": "51",
"vendor2": "eDreams"
},
{
"price3": "244",
"tax3": "48",
"vendor3": "Nustay.com"
},
{
"price4": null,
"tax4": null,
"vendor4": null
},
{
"price5": "253",
"tax5": "51",
"vendor5": "Tripadvisor"
}
]
],
[
{
"hotelName": "Park Grand London Hyde Park",
"hotelId": "3164384"
},
[
{
"price1": "263",
"tax1": "53",
"vendor1": "eDreams"
},
{
"price2": "263",
"tax2": "53",
"vendor2": "Booking.com"
},
{
"price3": "263",
"tax3": "53",
"vendor3": "Agoda.com"
},
{
"price4": null,
"tax4": null,
"vendor4": null
},
{
"price5": "263",
"tax5": "53",
"vendor5": "Tripadvisor"
}
]
],
[
{
"hotelName": "Park Plaza Westminster Bridge London",
"hotelId": "1657415"
},
[
{
"price1": "426",
"tax1": "85",
"vendor1": "eDreams"
},
{
"price2": "451",
"tax2": "113",
"vendor2": "Prestigia.com"
},
{
"price3": "415",
"tax3": "82",
"vendor3": "Nustay.com"
},
{
"price4": "455",
"tax4": "91",
"vendor4": "Agoda.com"
},
{
"price5": null,
"tax5": null,
"vendor5": null
}
]
],
[
{
"hotelName": "The Darlington Hyde Park",
"hotelId": "214639"
},
[
{
"price1": "252",
"tax1": "50",
"vendor1": "eDreams"
},
{
"price2": "252",
"tax2": "50",
"vendor2": "Booking.com"
},
{
"price3": "251",
"tax3": "50",
"vendor3": "Agoda.com"
},
{
"price4": null,
"tax4": null,
"vendor4": null
},
{
"price5": "252",
"tax5": "50",
"vendor5": "Tripadvisor"
}
]
}
Properties | Description |
---|---|
price | Price offered by the vendor |
vendor | Name of the vendor |
tax | Tax you will be charged at the booking |
hotelName | Name of the hotel |
hotelId | Id of the hotel in our system |
Each call in this pattern to our API will be counted as 1 API request. That means for every request to our API you will get 30 hotels in that target city.
Last modified 1mo ago