POST/v1/hotels/book

预订酒店

使用联系人、住客、价格和入住信息为所选房型创建酒店预订。

分享

使用联系人、住客、价格和入住信息为所选房型创建酒店预订。

接口

方法路径认证
POST/v1/hotels/book需要 API key
必需请求头:
Header说明
AuthorizationBearer <secret_key>. The secret is shown only once when the credential is created.
X-Travelandz-Id<public_key>:<profile_code>. The profile_code is the dp_-prefixed Developer Profile code shown in your dashboard. This binds the request to a profile and credential.
Content-TypeUse application/json for requests with a body.

Request Parameters

不需要路径参数或查询参数。

请求体结构

gdsprovider
number是
hotelCode
string是
holder
object是
holdername
string是
holderlastName
string是
holderemail
string是
holderlanguage
string否
holderphone
string否
rooms
array是
rooms[]rateKey
string是
rooms[]roomName
string是
rooms[]roomBoard
string是
rooms[]cancellationPolicies
array是
rooms[]cancellationPolicies[]amount
number是
rooms[]cancellationPolicies[]fromDate
string
Format: ISO 8601
是
rooms[]ratePrice
number是
rooms[]priceRangeCurrency
enum
EURUSDCNY
否
rooms[]priceRangeMinimum
number否
Minimum of the 25% of the original price of the booking
rooms[]priceRangeMaximum
number否
Maximum of the 100% of the original price of the booking.
rooms[]passengers
array是
rooms[]passengers[]roomId
number是
rooms[]passengers[]title
enum
mrmsmrsmiss
是
rooms[]passengers[]type
enum
adultchild
是
rooms[]passengers[]name
string是
rooms[]passengers[]lastName
string是
rooms[]passengers[]nationality
string
Format: 2 digits
是
rooms[]passengers[]age
number否
rooms[]passengers[]gender
enum
fm
否
rooms[]checkIn
string
Format: YYYY-MM-DD
是
rooms[]checkOut
string
Format: YYYY-MM-DD
是
searchBody
object是
searchBodylanguage
enum
eneszh
否
Default en
searchBodygdsprovider
number是
searchBodyhotelCode
string是
searchBodycheckIn
string
Format: YYYY-MM-DD
是
searchBodycheckOut
string
Format: YYYY-MM-DD
是
searchBodycountryCode
string
Format: 2 digits
是
searchBodyguestNationality
string
Format: 2 digits
是
searchBodyminRatePrice
number否
searchBodymaxRatePrice
number否
searchBodyrooms
array是
searchBodyrooms[]adults
number是
Minimum value: 1, Maximum value: 4
searchBodyrooms[]children
number否
Minimum value: 0, Maximum value: 4
searchBodyrooms[]childrenAges
array是
searchBodyrooms[]childrenAges[]
number[]是
searchBodycurrency
enum
EURUSDCNY
否
Default EUR
checkIn
string
Format: YYYY-MM-DD
是
checkOut
string
Format: YYYY-MM-DD
是

成功响应

返回 booking reference, status, provider response and confirmation details when available.

响应体结构

bookingReference
string是
clientReference
string是
liveMode
boolean是
True when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.

错误

状态代码场景
400unable_to_execute_bookingProvider could not execute the booking.
400-Invalid payload or provider error.
401/403auth codesInvalid credentials.
500-Internal error.

示例

bash
bash
curl -X POST https://api.sandbox.travelandz.com/v1/hotels/book \
  -H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  -H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
  -H "Content-Type: application/json" \
  -d '<request_body_json>'