Lydira API
EN

Uçuş rezervasyonuAdım 2 / 8

2Cevabı bekleyin

GET/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

  • iduuidzorunlu

    The operation_id the call answered with.

Yanıt · 202

  • statusenum

    queued until a worker takes the call, then running.

    şunlardan biriqueuedrunning

  • 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).

Yanıtlar

  • 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'
Yanıt
202
{
  "status": "queued",
  "operation_id": "5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e",
  "poll_url": "/api/v1/flights/operations/5d1f0b7e-8a2c-4e3f-9b6d-1c2a3b4c5d6e"
}