Wego Affiliate API Entegrasyonu: Developer Rehberi

Wego Affiliate API entegrasyonunu OAuth client credentials, search creation, polling, offset merge, trip/fare/provider modeli, rate limit, handoff ve commercial reconciliation ile developer gözüyle uygulayın.

Editoryal bilgi
Değişiklik geçmişi
  • 2026-09-26 — Provider companion standard applied; OAuth, polling, rate-limit and commercial handoff boundaries clarified.
İlgili platform profilleri
Advertisement

Wego Affiliate API, travel search için klasik synchronous API yerine token -> search session -> poll -> merge -> handoff lifecycle'ı sunar.

Flight flow:

text
OAuth token
    |
    v
POST /metasearch/flights/searches
    |
    v
search ID
    |
    v
GET /metasearch/flights/searches/{searchId}/results
    |
    v
offset-based polling
    |
    v
Trips + Fares + Providers
    |
    v
Wego handoff URL

Affiliate, distribution ve provider sorumlulukları için Wego profiline bakın. Bu rehber affiliate uygulama akışını ele alır.

1. Authentication

Token endpoint:

http
POST https://affiliate-api.wego.com/apps/oauth/token
Content-Type: application/json

Request:

json
{
  "client_id": "<client-id>",
  "grant_type": "client_credentials",
  "scope": "affiliate"
}

Response:

json
{
  "access_token": "<token>",
  "token_type": "bearer",
  "expires_in": 43199,
  "scope": "affiliates",
  "created_at": 1500000000
}

API calls:

http
Authorization: Bearer <access-token>

Secret/token frontend bundle'a konmamalıdır.

2. Token manager

ts
interface WegoToken {
  value: string;
  expiresAt: string;
}

interface WegoCredentials {
  clientId: string;
  secretRef?: string;
}

Token refresh single-flight olmalı; her worker aynı anda token istememelidir.

3. Flight search create endpoint

http
POST https://affiliate-api.wego.com/metasearch/flights/searches
Authorization: Bearer <token>
Content-Type: application/json

Basitleştirilmiş request:

json
{
  "search": {
    "adultsCount": 1,
    "childrenCount": 0,
    "infantsCount": 0,
    "cabin": "economy",
    "currencyCode": "TRY",
    "locale": "tr",
    "siteCode": "TR",
    "deviceType": "DESKTOP",
    "appType": "WEB_APP",
    "legs": [
      {
        "departureCityCode": "IST",
        "arrivalCityCode": "LON",
        "outboundDate": "2026-10-12"
      }
    ]
  }
}

Create response'un asıl kritik alanı search ID'dir.

4. Internal search model

ts
interface TravelSearchRequest {
  vertical: "flight" | "hotel";

  market: string;
  locale: string;
  currency: string;

  flight?: {
    legs: Array<{
      origin: string;
      destination: string;
      departureDate: string;
    }>;
    adults: number;
    children: number;
    infants: number;
    cabin: string;
  };

  hotel?: {
    locationId: string;
    checkIn: string;
    checkOut: string;
    rooms: Array<{
      adults: number;
      childAges: number[];
    }>;
  };
}

Provider request'i doğrudan UI contract yapmayın.

5. Search session modeli

ts
interface WegoSearchSession {
  internalSearchId: string;
  providerSearchId: string;
  vertical: "flight" | "hotel";

  status: "created" | "polling" | "complete" | "failed";

  requestHash: string;

  offset: number;
  stableCountPolls: number;
  pollCount: number;

  createdAt: string;
  lastPolledAt?: string;
}

Search ID short-lived operational state'tir, durable booking identity değildir.

6. Poll flight results

http
GET https://affiliate-api.wego.com/metasearch/flights/searches/{searchId}/results
  ?offset=0
  &locale=TR
  &currencyCode=TRY
Authorization: Bearer <token>

İlk response subset olabilir. Wego progressive rendering'i destekler.

7. Offset merge

Poll response'daki count/offset modeli aynı entity'leri tekrar taşıyabilir veya yeni fare'lar getirebilir.

Blind append yapmayın.

ts
interface WegoFlightResultStore {
  trips: Map<string, Trip>;
  legs: Map<string, Leg>;
  airports: Map<string, Airport>;
  airlines: Map<string, Airline>;
  providers: Map<string, Provider>;
  fares: Map<string, Fare>;
}

Merge:

text
poll response
  -> upsert shared entities
  -> append/update fares
  -> deduplicate
  -> rerank
  -> update offset

8. Polling strategy

Wego dokümantasyonu artan polling interval'i önerir:

text
poll 1 -> 500 ms
poll 2 -> 1 sec
poll 3 -> 2 sec
poll 4 -> 3 sec
poll 5 -> 4 sec

Stop heuristic:

üç ardışık poll aynı count dönüyorsa sonuç set'i mature kabul edilebilir.

Bu kuralı provider-specific orchestration policy olarak adapter içinde tutun.

9. Trip ve Fare ayrımı

Wego Flights response modelinde Trip itinerary'yi, Fare ise provider + price'ı temsil eder.

ts
interface FlightTrip {
  id: string;
  legIds: string[];
}

interface FlightFare {
  id: string;
  tripId: string;
  providerId: string;

  amount: number;
  currency: string;

  handoffUrl: string;

  bookingFee?: number;
  paymentFee?: number;
}
text
trip != fare

Bir trip birden fazla provider/fare ile satılabilir.

10. Shared entity dictionaries

Wego response data'yı tekrar azaltmak için referanslarla modeller.

text
Trip
  -> legIds

Leg
  -> airport codes
  -> airline refs

Fare
  -> trip
  -> provider
  -> handoff

Frontend için canonical model üretirken referansları resolve edin; source IDs'i de koruyun.

11. More fares endpoint

Default search bir trip için best fare döndürebilir. Kullanıcı belirli trip'e ilgi gösterdiğinde ek fare'lar istenebilir.

http
GET https://affiliate-api.wego.com/metasearch/flights/trips/{tripId}
Authorization: Bearer <token>

Bu endpoint'i tüm trip'ler için eagerly çağırmak yerine user intent ile tetiklemek latency/quota açısından daha verimlidir.

Hotel lifecycle da create + poll mantığını kullanır. Poll response hotel/rate entity'leri progressive getirir.

Internal model:

ts
interface HotelSearchResult {
  hotelId: string;
  name: string;

  bestRate?: {
    providerId: string;
    amount: number;
    currency: string;
    handoffUrl: string;
  };

  observedAt: string;
}

Hotel merge sırasında amenity, brand, chain, district ve property type dictionaries de deduplicate edilmelidir.

13. Handoff URL

Wego policy, search result'ta Wego deep link'lerinin kullanılmasını ister.

Bu nedenle provider'ın son URL'sini kendiniz reconstruct etmeyin; Wego handoff URL'ini contract olarak ele alın.

ts
interface AffiliateClick {
  internalSearchId: string;
  providerSearchId: string;
  vertical: "flight" | "hotel";
  resultId: string;
  providerId: string;
  handoffUrl: string;
  clickedAt: string;
}

Redirect safety:

  • HTTPS only,
  • Wego-owned destination allowlist,
  • raw arbitrary URL passthrough yok.

14. Search-to-click policy

Wego Affiliate policy, gerçek kullanıcı search'leri ve minimum search-to-click davranışı bekler.

Bu nedenle:

  • bot-generated search yapmayın,
  • prefetch ile gereksiz search üretmeyin,
  • duplicate query suppression uygulayın,
  • search-to-click metriğini product KPI olarak izleyin.

15. Rate limits

Wego get-started dokümantasyonu search request'lerine rate limit uygular. Polling aynı şekilde search quota'sına sayılmayabilir; yine de backend pressure açısından kontrol edilmelidir.

Response headers:

text
X-RateLimit-Limit
X-RateLimit-Remaining
X-RateLimit-Reset

Internal metric:

text
wego_rate_limit_remaining
wego_search_429
wego_search_to_click
wego_polls_per_search

16. Error taxonomy

text
WEGO_AUTH
WEGO_RATE_LIMIT
WEGO_BAD_REQUEST
WEGO_SEARCH_CREATE_FAILED
WEGO_SEARCH_EXPIRED
WEGO_POLL_FAILED
WEGO_PARSE
WEGO_EMPTY_RESULT
WEGO_HANDOFF_INVALID
WEGO_PROVIDER_RESULT_INVALID

400/401 genellikle blind retry edilmemelidir.

429/5xx için bounded backoff uygulanabilir.

17. Cache

Search response cache key:

text
vertical
+ market
+ locale
+ currency
+ dates
+ occupancy/passengers
+ cabin/location

Live travel price cache'i kısa ömürlü olmalıdır. Duplicate suppression için faydalıdır; booking truth değildir.

18. Observability

Auth

  • token success,
  • token age,
  • refresh failures.
  • create success,
  • p50/p95 create latency,
  • first-result latency,
  • poll count,
  • stable-count completion,
  • empty-result rate.

Quota

  • remaining quota,
  • 429,
  • search-to-click.

Handoff

  • click count,
  • invalid link,
  • provider landing success.

Commercial

  • attributed booking,
  • commission state,
  • cancellation-adjusted conversion.

19. Commercial reconciliation

text
search
  -> Wego fare/rate
  -> handoff click
  -> provider booking
  -> conversion/commission
  -> cancellation

Normalize:

ts
interface AffiliateConversion {
  clickId?: string;
  bookingId: string;
  providerId: string;
  bookingValue: number;
  currency: string;
  status: "pending" | "approved" | "cancelled";
}

20. Test matrisi

TestBeklenen
one-way flight1 trip/leg flow
round-trip2 legs
multi-city>2 legs
multiple faressame trip / different providers
create successsearch ID persisted
partial pollUI renders
offset pollno duplicates
same count x3polling stops
429bounded backoff
token expiryrefresh
invalid handoffblocked/alert
hotel searchprogressive rate merge

21. Go-live checklist

  • Wego credentials server-side
  • token cache/refresh implemented
  • search request mapper tested
  • search ID lifecycle tracked
  • offset merge idempotent
  • polling backoff implemented
  • stop rule implemented
  • flight Trip/Fare model separated
  • hotel rate model normalized
  • rate-limit headers monitored
  • search-to-click KPI monitored
  • only valid Wego handoff URLs exposed
  • redirect security applied
  • client disconnect stops polling
  • commercial reconciliation ownership defined

Sonuç

Wego Affiliate API'yi “OAuth + search endpoint” olarak görmek eksik kalır.

Doğru architecture:

text
user query
  -> normalized request
  -> Wego search
  -> provider search ID
  -> progressive poll
  -> entity merge
  -> canonical trip/hotel offers
  -> Wego handoff
  -> commercial reconciliation

Bu yapı async search lifecycle'ını, quota/commercial policy'yi ve downstream handoff'u aynı operasyonel modelde toplar.

Provider companion özeti

AlanDurum
ErişimAffiliate credentials / client ID gerekir
AuthOAuth client credentials / bearer token
Primary lifecycleSearch create → Search ID → result polling → merge → Wego deeplink
PaginationResult offset/merge semantics; UI sort/filter/pagination client-side yapılabilir
PollingSearch lifecycle'ın temel parçası; polling search-request kotasına sayılmaz
Default search rate limitNormal key: 500 search/saat; test key: 50 search/saat
Commercial qualitySearch-to-click ratio en az %5 tutulmalı; kötü oran rate limit'i etkileyebilir
Booking ownershipWego deeplink sonrası downstream provider
EvidenceOfficial docs reviewed; active affiliate account testi iddia edilmiyor
CodeIllustrative

Capability boundary

OAuth token → create search → Search ID → poll result offsets → merge Trips/Fares/Providers → Wego redirect/deeplink → downstream provider.

Search result booking confirmation değildir.

Rate-limit ve polling contract

Wego public docs standard key için 500 search request/saat, test key için 50/saat belirtir. Poll çağrıları search request limitine dahil değildir. Yine de tight-loop polling yapmayın; progress-aware backoff ve maximum duration kullanın.

Idempotency / ordering

Aynı search ID ve offset tekrar işlendiğinde duplicate trip/fare oluşmamalıdır. Offset monoton ilerlemeli; eski snapshot yeni provider/fare state'ini ezmemelidir.

Commercial handoff ve observability

Production affiliate traffic gerçek user search'e dayanmalı ve Wego deeplink'leri kullanılmalıdır. Search-to-click ratio, 429/limit kullanımı, poll count, time-to-first-result, time-to-complete, empty result ve deeplink success birlikte izlenmelidir.

Teknik danışmanlık

Benzer bir entegrasyon mu planlıyorsunuz?

Gereksinim, feed/API tasarımı ve production yaklaşımını birlikte değerlendirebiliriz.

Projenizi konuşalım →

Kaynaklar

İlgili içerikler

multi-vertical-metasearch

Wego: Affiliate, Distribution ve Provider Sınırları

wego.com

Wego affiliate arama, distribution ve provider rollerini ayırın; fiyat alma, erişim ve yönlendirme hatalarını operasyon kontrolleriyle teşhis edin.

wegoflighthotel
İncele →
integration

Skyscanner Flight API Entegrasyonu: Developer Rehberi

developers.skyscanner.net

Skyscanner Flights Live Prices API entegrasyonunu x-api-key auth, create/poll lifecycle, request-response modelleri, itinerary/leg/segment mapping, agent/pricing option, rate limit, polling ve observability ile developer gözüyle uygulayın.

skyscannerflightapi
İncele →
integration

trivago FastConnect Entegrasyonu: Developer Rehberi

developer.trivago.com

trivago FastConnect entegrasyonunu hotel inventory, hotel_availability endpoint, form-urlencoded request, JSON response, room/rate model, latency, deeplink, conversion tracking ve monitoring ile developer gözüyle uygulayın.

trivagofastconnecthotel
İncele →
travel-ecosystem

ENUYGUN: Türkiye OTA ve Travel Marketplace Profili

enuygun.com

Uçak, otobüs, otel, araç kiralama ve transfer ürünlerini tek travel marketplace içinde sunan ENUYGUN'un Türkiye dağıtım ekosistemindeki rolü.

enuygunotatravel-marketplace
İncele →
comparison

Google Flights vs Skyscanner: Uçuş Metasearch Karşılaştırması

Google Flights ve Skyscanner'ı flight search, discovery, price tracking, API erişimi ve provider handoff açısından karşılaştırın.

google-flightsskyscannerflight
İncele →
business-model

Metasearch vs Affiliate: Product Modeli ve Ticari İlişki

Metasearch ile affiliate modelini discovery, traffic ownership, deeplink, attribution, booking ownership ve monetization açısından ayırın.

metasearchaffiliatecpc
İncele →