2Wait for the answer
/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
iduuidrequiredThe
operation_idthe call answered with.
Response · 202
statusenumqueueduntil a worker takes the call, thenrunning.one of
queuedrunningoperation_iduuidThe call's operation, kept for 7 days for a hold, ticket, release or purchase sent with an Idempotency-Key, else 15 minutes.
poll_urlstringWhere the answer is read (
GET).
Responses
200The finished call's own answer: a search'sFlightSearchResponse, a price'sFlightPriceResponse, the rules, a ticket'sFlightTicketedBooking, a release's{ released, status }. See the call's own entry for its body.201A finished hold'sFlightHoldResponseor a finished purchase'sFlightTicketedBooking. See the call's own entry for its body.401Missing or invalid Bearer token402The 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, withdetails.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 anIdempotency-Keyis 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 sameIdempotency-Keyand the same body: it replays the first answer, or answers502 booking_unresolvedwith 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 inerror).429Rate limit exceeded502The supplier's answer is unknown: the booking may or may not exist, and money may already have moved. It is also whatpoll_urlanswers 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 itsIdempotency-Keyanswers 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 itsIdempotency-Key, so a new attempt takes a new key; a release is sent again. With nobooking_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 sameIdempotency-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'{
"status": "queued",
"operation_id": "5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e",
"poll_url": "/api/v1/flights/operations/5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e"
}