Guida rapida
In questa pagina otterrai un token con le tue credenziali partner e invierai una richiesta di camere e tariffe. Ti servono apiKey, apiSecret e l’ID HMS dell’hotel (hotelID); se non li hai ancora, contatta il supporto.
1. Ottieni un token#
L’endpoint di login accetta campi form e non richiede alcun header di autenticazione:
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"
}Salva il token: per 7 giorni lo userai in tutte le richieste relative a questo hotel.
export HMS_TOKEN="eyJlbmREYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTE1IDEwOjI0OjMxLjAwMDAwMCIs…"2. Richiedi camere e tariffe#
Una ricerca di due notti per due adulti:
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. Leggi la risposta#
Ogni tipologia di camera contiene i propri trattamenti (accommodationTypes) e ogni trattamento le proprie opzioni di prezzo (prices). Un esempio troncato:
{
"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 persone, tariffa standard (rimborsabile).2-0: 2 persone, tariffa non rimborsabile (nonRefundable: "[NR]").priceè il totale del soggiorno;totalè il numero di notti. Le tariffe per notte si trovano nell’arrayprices[]della risposta completa.- Nella prenotazione, l’
iddella tipologia di camera si invia comeroomTypeIDe l’iddel trattamento comeratePlanID.
Per proseguire#
- Flusso di prenotazione — dalla scelta della camera all’invio con
BookingPushRQ - Flusso di pagamento — pagamento in hotel, bonifico bancario, carta di credito, pagamento online
- Codici di errore — valori di
errorCodeemessage