Lydira API
TR

Flight bookingStep 2 of 8

2Wait for the answer

GET/api/v1/flights/operations/{id}

Reachable with a narrow key: flight_booking

Every call that waits on the supplier (search, price, rules, hold, ticket, release, purchase) answers 202 at once with an operation_id and a poll_url, unless it is refused at once (a ticket or a purchase whose payment, token or payer fails its check answers a 4xx and queues nothing). Read the poll_url after Retry-After seconds (1 s for the first 2 s, 2 s after that) until it answers anything but 202. That answer is the call's own, with the status and body its step page shows. A search the offer cache already holds answers 200 straight away.

A call that has not finished in 3 minutes is lost, and the poll says so itself. Stop polling then.

Parameters

Path

  • iduuidrequired

    The operation_id the call answered with.

Response · 202

  • statusenum

    queued until a worker takes the call, then running.

    one ofqueuedrunning

  • operation_iduuid

    The call's operation, kept for 7 days for a hold, ticket, release or purchase sent with an Idempotency-Key, else 15 minutes.

  • poll_urlstring

    Where the answer is read (GET).

Responses

  • 200The finished call's own answer: a search's FlightSearchResponse, a price's FlightPriceResponse, the rules, a ticket's FlightTicketedBooking, a release's { released, status }. See the call's own entry for its body.
  • 201A finished hold's FlightHoldResponse or a finished purchase's FlightTicketedBooking. See the call's own entry for its body.
  • 401Missing or invalid Bearer token
  • 402The month's searches and the search wallet are both used up.
  • 403The key cannot reach the booking API: the account lacks an add-on (addon_required, with details.missing), the plan has no API access, or the key's scope is narrow.
  • 404No operation by that id for this key: it has expired (a hold, a ticket, a release or a purchase sent with an Idempotency-Key is kept for 7 days, any other call for 15 minutes), it can no longer be read, or another key started it. On a hold, a ticket or a purchase, send the call again with the same Idempotency-Key and the same body: it replays the first answer, or answers 502 booking_unresolved with the booking its key claimed. Read that booking (GET /api/v1/flights/bookings/{booking_id}) and refund the card only if it was not ticketed. Send a release (DELETE) again as it was. Do not refund the card on this answer alone.
  • 409The booking cannot go ahead as asked. price_changed: price again and confirm the new total with your customer. approval_required: the agency approves the ticket first, then call ticket again. hold_expired: search again.
  • 410The search or the offer has expired. Search again.
  • 422The request was refused before anything was booked, or the supplier refused it (provider_rejected, with its reason in error).
  • 429Rate limit exceeded
  • 502The supplier's answer is unknown: the booking may or may not exist, and money may already have moved. It is also what poll_url answers when a hold, a ticket, a release or a purchase did not finish in 3 minutes, and what a hold, a ticket or a purchase sent again with its Idempotency-Key answers once its call can no longer be read. Read the booking (GET /api/v1/flights/bookings/{booking_id}) before you retry or refund anything, and refund the card only if it was not ticketed. A hold, a ticket or a purchase keeps this answer under its Idempotency-Key, so a new attempt takes a new key; a release is sent again. With no booking_id, no booking was found under the key: hold again with a new key, and ask the agency before you refund a purchase.
  • 503The supplier could not be reached, the call could not be queued, or a search, a price or the rules did not finish in 3 minutes (provider_unavailable). Nothing was booked: a search costs nothing, and a hold or a purchase is retried with the same Idempotency-Key.
curl -X GET 'https://YOUR-CELL.lydira.com/api/v1/flights/operations/5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e' \
  -H 'Authorization: Bearer sek_YOUR_API_KEY'
Response
202
{
  "status": "queued",
  "operation_id": "5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e",
  "poll_url": "/api/v1/flights/operations/5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e"
}