Hopp til innholdet

Fly

Create an order (hold) from an offer. Requires an `Idempotency-Key` header.

post/v1/flights/orders

  • Krever autentisering
  • Krever Idempotency-Key

ForespørselstekstFlightOrderCreateRequest

  • offerIdstring
  • Passenger[]
    • typestring

      ADT | CHD | INF.

    • genderstring

      M | F.

    • firstNamestring
    • lastNamestring
    • dateOfBirthstringkan være null

      yyyy-MM-dd.

    • nationalitystringkan være null

      ISO 3166-1 alpha-2.

    • Document
  • Contact
    • emailstring
    • phonestring

      E.164 or national with dial code.

  • AncillarySelection[]

    Extras to add to the order, chosen from GET /v1/flights/offers/{offerId}/ancillaries. Priced and ticketed with the order.

    • keystring

      The `key` of an option returned by the offer's ancillaries.

    • passengerIndexinteger (int32)

      0-based index into `passengers` — who the extra is for.

Eksempel
{
  "offerId": "string",
  "passengers": [
    {
      "type": "string",
      "gender": "string",
      "firstName": "string",
      "lastName": "string",
      "dateOfBirth": "string",
      "nationality": "string",
      "document": {
        "type": "string",
        "number": "string",
        "issuingCountry": "string",
        "expiryDate": "string",
        "issueDate": "string"
      }
    }
  ],
  "contact": {
    "email": "string",
    "phone": "string"
  },
  "ancillaries": [
    {
      "key": "string",
      "passengerIndex": 1
    }
  ]
}

Svar

201CreatedFlightOrder

  • orderIdstring
  • bookingReferencestringkan være null
  • statusstring

    held | ticketed | cancelled | voided | refunded | pending | exchanged | expired | unknown.

  • ticketTimeLimitstring (date-time)kan være null
  • Money

    Money on the wire: decimal string (never a float) + ISO 4217.

    • amountstring
    • currencystring
  • PassengerPricing[]
    • typestring

      ADT | CHD | INF.

    • quantityinteger (int32)
    • Money

      Money on the wire: decimal string (never a float) + ISO 4217.

    • Money

      Money on the wire: decimal string (never a float) + ISO 4217.

    • Money

      Money on the wire: decimal string (never a float) + ISO 4217.

    • Tax[]
  • Slice[]
    • durationMinutesinteger (int32)
    • Segment[]
  • OrderPassenger[]
    • typestring
    • firstNamestring
    • lastNamestring
    • genderstringkan være null
    • dateOfBirthstringkan være null
    • nationalitystringkan være null
    • Ticket[]
  • Contact
    • emailstring
    • phonestring

      E.164 or national with dial code.

  • priceChangedboolean
  • canCancelbooleankan være null
  • 402Payment RequiredProblemdetaljer etter RFC 7807
  • 409ConflictProblemdetaljer etter RFC 7807

Kodeeksempler

Komplette programmer som signerer forespørselen slik gatewayen verifiserer den. Erstatt YOUR_KEY_ID og YOUR_SECRET.

# Sign the request: METHOD \n path+query \n unix time \n nonce \n sha256(body)
KEY_ID="YOUR_KEY_ID"
SECRET="YOUR_SECRET"
BODY='{
  "offerId": "string",
  "passengers": [
    {
      "type": "string",
      "gender": "string",
      "firstName": "string",
      "lastName": "string",
      "dateOfBirth": "string",
      "nationality": "string",
      "document": {
        "type": "string",
        "number": "string",
        "issuingCountry": "string",
        "expiryDate": "string",
        "issueDate": "string"
      }
    }
  ],
  "contact": {
    "email": "string",
    "phone": "string"
  },
  "ancillaries": [
    {
      "key": "string",
      "passengerIndex": 1
    }
  ]
}'
TS=$(date +%s)
NONCE=$(openssl rand -hex 16)
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | sed 's/^.* //')
CANON=$(printf 'POST\n/v1/flights/orders\n%s\n%s\n%s' "$TS" "$NONCE" "$BODY_HASH")
SIG=$(printf '%s' "$CANON" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')

curl -X POST "https://api.dubaitrip.com/v1/flights/orders" \
  -H "X-API-Key: $KEY_ID" \
  -H "X-Timestamp: $TS" \
  -H "X-Nonce: $NONCE" \
  -H "X-Signature: $SIG" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "$BODY"