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>'