You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

关于Amadeus Self Service开发者API是否包含航班与酒店API预订方法的问询

Amadeus Self Service API: Flight & Hotel Booking Capabilities

Hey there, great question! The Amadeus Self Service Developer API absolutely includes dedicated methods for both flight and hotel bookings. Let me break this down clearly for you:

Flight Bookings

  • Core API: The Flight Create Orders endpoint is your go-to for flight bookings. It lets you create a confirmed booking using a valid flight offer you've previously retrieved via the Flight Offers Search API.
  • Key Requirement: You must first fetch a flight offer (which includes a unique offerId), then pass that ID along with traveler details, payment information, and other required data to the booking endpoint.
  • Quick Example (cURL):
curl --request POST \
  --url https://test.api.amadeus.com/v1/booking/flight-orders \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "data": {
      "type": "flight-order",
      "flightOffers": [{"type": "flight-offer", "id": "YOUR_OFFER_ID"}],
      "travelers": [{"id": "1", "dateOfBirth": "1990-01-01", "name": {"firstName": "JOHN", "lastName": "DOE"}, "contact": {"emailAddress": "john.doe@example.com", "phones": [{"deviceType": "MOBILE", "countryCallingCode": "1", "number": "5551234567"}]}}],
      "payments": [{"type": "credit-card", "creditCard": {"number": "4111111111111111", "expiryDate": "2025-12", "securityCode": "123", "holderName": "JOHN DOE"}}]
    }
  }'
  • Bonus: You can also use the Flight Orders Management endpoints to retrieve, modify, or cancel existing flight orders post-booking.

Hotel Bookings

  • Core API: For hotel reservations, use the Hotel Bookings endpoint. Similar to flights, you'll need a valid hotel offer (with an offerId) from either the Hotel Search or Hotel Offers Search APIs first.
  • Key Features: Supports booking single or multiple rooms, and requires guest details, payment method, and any special requests for the stay.
  • Quick Example (cURL):
curl --request POST \
  --url https://test.api.amadeus.com/v3/booking/hotel-bookings \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "data": {
      "type": "hotel-booking",
      "hotelOfferId": "YOUR_HOTEL_OFFER_ID",
      "guests": [{"id": "1", "name": {"title": "MR", "firstName": "JOHN", "lastName": "DOE"}, "contact": {"emailAddress": "john.doe@example.com"}}],
      "payments": [{"type": "credit-card", "creditCard": {"number": "4111111111111111", "expiryDate": "2025-12", "securityCode": "123", "holderName": "JOHN DOE"}}]
    }
  }'
  • Heads Up: Some hotel offers may require additional parameters (like room preferences or guest special requests) so be sure to check the specific offer details and API docs.

General Notes

  • All booking operations require a valid OAuth 2.0 access token, which you can get via the OAuth 2.0 Token endpoint.
  • Use the sandbox/test environment for development—bookings here won't result in real charges or reservations.
  • Make sure you're using the latest API versions, as Amadeus regularly updates endpoints and features.

内容的提问来源于stack exchange,提问作者Lyndon Durham

火山引擎 最新活动