2Cevabı bekleyin
/api/v1/flights/operations/{id}Dar kapsamlı anahtarla da çalışır: flight_booking
Tedarikçiyi bekleyen her çağrı (arama, fiyatlama, kurallar, opsiyon, bilet, opsiyonu bırakma, satın alma) hemen 202, bir operation_id ve bir poll_url döndürür. Hemen reddedilen bir bilet ya da satın alma (ödemesi, belirteci ya da carisi kontrolden geçmeyen) ise 4xx döner ve hiçbir şeyi kuyruğa almaz. poll_url adresini Retry-After saniye sonra okuyun (ilk 2 sn için 1 sn, sonrasında 2 sn) ve 202 dışında bir cevap gelene kadar tekrarlayın. Gelen cevap çağrının kendi cevabıdır; durum kodu ve gövdesi adım sayfasındakiyle aynıdır. Teklif önbelleğinde olan bir arama hemen 200 döner.
3 dakikada bitmeyen çağrı kaybolmuştur ve yoklama bunu kendisi söyler. O noktada yoklamayı bırakın.
Parametreler
Yol
iduuidzorunluThe
operation_idthe call answered with.
Yanıt · 202
statusenumqueueduntil a worker takes the call, thenrunning.şunlardan biri
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).
Yanıtlar
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"
}