Authentification
L’accès à l’API Online Booking se fait avec des identifiants partenaire délivrés par HMS. L’endpoint de connexion échange apiKey et apiSecret contre un jeton, envoyé dans l’en-tête Authorization: Bearer de toutes les autres requêtes. Pour plus de détails, consultez le guide Authentification.
Se connecter et obtenir un jeton#
POST
/external/public/loginAucune authentification requise · Corps: application/x-www-form-urlencoded ou multipart/form-data
Vérifie les identifiants du partenaire et délivre un jeton si le partenaire est autorisé pour l’hôtel. Le jeton est lié à un seul hôtel ; connectez-vous séparément pour chaque hôtel.
Champs de formulaire
apiKeystringobligatoireClé partenaire délivrée par HMS.
apiSecretstringobligatoireSecret partenaire. À conserver uniquement côté serveur.
hotelCodeintegerobligatoireIdentifiant HMS de l’hôtel (
hotelID). Le partenaire doit être autorisé pour cet hôtel.hotelSeoUrlstringSlug SEO de l’hôtel dans HMS. Utilisé à la place de
hotelCode uniquement par le moteur de réservation propre à HMS ; les intégrations tierces doivent envoyer hotelCode.Réponse
200 Jeton et informations de l’hôtel. Le jeton est valable 7 jours ; renouvelez-le en vous reconnectant avant son expiration.
successbooleanIndicateur de résultat.
hotelCodestringIdentifiant de l’hôtel auquel le jeton est lié.
tokenstringJeton Bearer. Considérez-le comme opaque ; ne l’analysez pas.
hotelSeoUrlstring | nullSlug SEO de l’hôtel.
Réponses d’erreur
- 200
partner_is_not_found— la paire de clés ne correspond pas ;hotel_is_not_found— aucun hôtel pourhotelSeoUrl;hotel_permission_is_not_found— le partenaire n’est pas autorisé pour cet hôtel ou l’autorisation est inactive.
curl "https://test.hms.gen.tr/external/public/login" \
-d "apiKey=5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q=" \
-d "apiSecret=a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19" \
-d "hotelCode=1000"const res = await fetch("https://test.hms.gen.tr/external/public/login", {
method: "POST",
body: new URLSearchParams([
["apiKey", "5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q="],
["apiSecret", "a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19"],
["hotelCode", "1000"]
])
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/public/login');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'apiKey' => '5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q=',
'apiSecret' => 'a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19',
'hotelCode' => '1000',
]),
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"hotelCode": "1000",
"token": "eyJlbmREYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTE1IDEwOjI0OjMxLjAwMDAwMCIsInRpbWV6b25lX3R5cGUiOjMsInRpbWV6b25lIjoiRXVyb3BlL0lzdGFuYnVsIn0sInRva2VuIjoiM2tkOXNscTJwbTh2eHI0dHp5Nm53YjFoYzdmajVnYTAiLCJob3RlbElEIjoxMDAwLCJ1c2VySUQiOjQyLCJkYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTA4IDEwOjI0OjMxLjAwMDAwMCJ9fQ==",
"hotelSeoUrl": "demo-otel"
}{
"success": false,
"token": null,
"message": "hotel_permission_is_not_found"
}