使用联系人、住客、价格和入住信息为所选房型创建酒店预订。
接口
| 方法 | 路径 | 认证 |
|---|---|---|
POST | /v1/hotels/book | 需要 API key |
| Header | 说明 |
|---|---|
Authorization | Bearer <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-Type | Use application/json for requests with a body. |
Request Parameters
不需要路径参数或查询参数。
请求体结构
gdsproviderhotelCodeholderholdernameholderlastNameholderemailholderlanguageholderphoneroomsrooms[]rateKeyrooms[]roomNamerooms[]roomBoardrooms[]cancellationPoliciesrooms[]cancellationPolicies[]amountrooms[]cancellationPolicies[]fromDaterooms[]ratePricerooms[]priceRangeCurrencyrooms[]priceRangeMinimumMinimum of the 25% of the original price of the booking
rooms[]priceRangeMaximumMaximum of the 100% of the original price of the booking.
rooms[]passengersrooms[]passengers[]roomIdrooms[]passengers[]titlerooms[]passengers[]typerooms[]passengers[]namerooms[]passengers[]lastNamerooms[]passengers[]nationalityrooms[]passengers[]agerooms[]passengers[]genderrooms[]checkInrooms[]checkOutsearchBodysearchBodylanguageDefault en
searchBodygdsprovidersearchBodyhotelCodesearchBodycheckInsearchBodycheckOutsearchBodycountryCodesearchBodyguestNationalitysearchBodyminRatePricesearchBodymaxRatePricesearchBodyroomssearchBodyrooms[]adultsMinimum value: 1, Maximum value: 4
searchBodyrooms[]childrenMinimum value: 0, Maximum value: 4
searchBodyrooms[]childrenAgessearchBodyrooms[]childrenAges[]searchBodycurrencyDefault EUR
checkIncheckOut成功响应
返回 booking reference, status, provider response and confirmation details when available.
响应体结构
bookingReferenceclientReferenceliveModeTrue when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.
错误
| 状态 | 代码 | 场景 |
|---|---|---|
400 | unable_to_execute_booking | Provider could not execute the booking. |
400 | - | Invalid payload or provider error. |
401/403 | auth codes | Invalid credentials. |
500 | - | Internal error. |
示例
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>'