Mulai cepat
Di halaman ini Anda akan mendapatkan token dengan kredensial mitra Anda dan mengirim kueri kamar dan tarif. Anda memerlukan apiKey, apiSecret, dan ID HMS hotel (hotelID); jika belum memilikinya, hubungi tim dukungan.
1. Dapatkan token#
Endpoint login menerima field form dan tidak memerlukan header autentikasi:
curl "https://test.hms.gen.tr/external/public/login" \
-d "apiKey=$HMS_API_KEY" \
-d "apiSecret=$HMS_API_SECRET" \
-d "hotelCode=1000"{
"success": true,
"hotelCode": "1000",
"token": "eyJlbmREYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTE1IDEwOjI0OjMxLjAwMDAwMCIs…",
"hotelSeoUrl": "demo-otel"
}Simpan token; token ini digunakan pada setiap permintaan untuk hotel ini selama 7 hari.
export HMS_TOKEN="eyJlbmREYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTE1IDEwOjI0OjMxLjAwMDAwMCIs…"2. Kueri kamar dan tarif#
Pencarian dua malam untuk dua orang dewasa:
curl "https://test.hms.gen.tr/external/online/roomType" \
-H "Authorization: Bearer $HMS_TOKEN" \
-d "hotelID=1000" \
-d "startDate=2026-08-18" \
-d "endDate=2026-08-20" \
-d "adultCount=2" \
-d "language=en"const res = await fetch("https://test.hms.gen.tr/external/online/roomType", {
method: "POST",
headers: { "Authorization": `Bearer ${process.env.HMS_TOKEN}` },
body: new URLSearchParams({
hotelID: "1000",
startDate: "2026-08-18",
endDate: "2026-08-20",
adultCount: "2",
language: "en"
})
});
const data = await res.json();
if (!data.success) throw new Error(`${data.errorCode}: ${data.errorMessage}`);
for (const room of data.items) {
console.log(room.name, room.roomCount, "rooms");
}$ch = curl_init('https://test.hms.gen.tr/external/online/roomType');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('HMS_TOKEN')],
CURLOPT_POSTFIELDS => http_build_query([
'hotelID' => 1000,
'startDate' => '2026-08-18',
'endDate' => '2026-08-20',
'adultCount' => 2,
'language' => 'en',
]),
]);
$data = json_decode(curl_exec($ch), true);
if (empty($data['success'])) {
throw new RuntimeException($data['errorCode'] . ': ' . $data['errorMessage']);
}
foreach ($data['items'] as $room) {
echo $room['name'], ' · ', $room['roomCount'], " rooms\n";
}3. Baca respons#
Setiap tipe kamar berisi meal plan-nya (accommodationTypes), dan setiap meal plan berisi opsi harganya (prices). Contoh yang dipotong:
{
"success": true,
"items": [
{
"id": 2,
"name": "Standard Room",
"roomCount": 5,
"currency": "TRY",
"accommodationTypes": [
{
"id": 2,
"title": "Bed & Breakfast",
"priceType": 0,
"prices": {
"2-1": {
"total": 2,
"price": "1930.00",
"currency": "TRY",
"nonRefundable": "",
"id": "2/2"
},
"2-0": {
"total": 2,
"price": "1737.00",
"currency": "TRY",
"nonRefundable": "[NR]",
"id": "2-0/2"
}
}
}
]
}
],
"count": 1
}2-1: 2 orang, tarif standar (dapat di-refund).2-0: 2 orang, tarif tidak dapat di-refund (nonRefundable: "[NR]").priceadalah total untuk seluruh masa menginap;totaladalah jumlah malam. Tarif per malam ada di arrayprices[]pada respons lengkap.- Dalam reservasi,
idtipe kamar dikirim sebagairoomTypeIDdanidmeal plan sebagairatePlanID.
Selanjutnya#
- Alur reservasi — dari pemilihan kamar hingga pengiriman
BookingPushRQ - Alur pembayaran — bayar di hotel, transfer bank, kartu kredit, pembayaran online
- Kode error — nilai
errorCodedanmessage