{
  "info": {
    "name": "Resvisor Acente API (v1)",
    "description": "Acente entegrasyon API'si. Akış: 1) /v1/auth/token ile API key+secret → JWT (otomatik {{token}} değişkenine yazılır). 2) Diğer tüm istekler Bearer {{token}} kullanır. baseUrl prod: https://api.woxxtravelglobal.com. Sandbox key ile booking gerçek para almaz (UAT).",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.woxxtravelglobal.com" },
    { "key": "apiKey", "value": "pk_sb_xxx" },
    { "key": "secret", "value": "sk_sb_xxx" },
    { "key": "token", "value": "" },
    { "key": "idempotencyKey", "value": "book-001" },
    { "key": "bookingRef", "value": "" }
  ],
  "item": [
    {
      "name": "Kimlik",
      "item": [
        {
          "name": "POST /v1/auth/token (API key → JWT)",
          "event": [
            {
              "listen": "test",
              "script": { "type": "text/javascript", "exec": [
                "var j = pm.response.json();",
                "if (j.token) { pm.collectionVariables.set('token', j.token); console.log('token kaydedildi'); }",
                "pm.test('200 + token', function(){ pm.response.to.have.status(200); pm.expect(j.token).to.be.a('string'); });"
              ] }
            }
          ],
          "request": {
            "method": "POST",
            "header": [ { "key": "Content-Type", "value": "application/json" } ],
            "url": { "raw": "{{baseUrl}}/v1/auth/token", "host": ["{{baseUrl}}"], "path": ["v1","auth","token"] },
            "body": { "mode": "raw", "raw": "{\n  \"apiKey\": \"{{apiKey}}\",\n  \"secret\": \"{{secret}}\"\n}" }
          }
        },
        {
          "name": "GET /v1/me (token bilgisi)",
          "request": {
            "method": "GET",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" } ],
            "url": { "raw": "{{baseUrl}}/v1/me", "host": ["{{baseUrl}}"], "path": ["v1","me"] }
          }
        }
      ]
    },
    {
      "name": "Arama",
      "item": [
        {
          "name": "POST /v1/hotels/search",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" } ],
            "url": { "raw": "{{baseUrl}}/v1/hotels/search", "host": ["{{baseUrl}}"], "path": ["v1","hotels","search"] },
            "body": { "mode": "raw", "raw": "{\n  \"checkIn\": \"2026-07-15\",\n  \"checkOut\": \"2026-07-18\",\n  \"adults\": 2,\n  \"children\": 0,\n  \"destinationId\": 1176,\n  \"currency\": \"EUR\",\n  \"sourceCountryCode\": \"TR\"\n}" }
          }
        },
        {
          "name": "POST /v1/tours/search",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" } ],
            "url": { "raw": "{{baseUrl}}/v1/tours/search", "host": ["{{baseUrl}}"], "path": ["v1","tours","search"] },
            "body": { "mode": "raw", "raw": "{\n  \"startDate\": \"2026-07-15\",\n  \"adults\": 2,\n  \"children\": 0,\n  \"currency\": \"EUR\"\n}" }
          }
        },
        {
          "name": "POST /v1/cruises/search",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" } ],
            "url": { "raw": "{{baseUrl}}/v1/cruises/search", "host": ["{{baseUrl}}"], "path": ["v1","cruises","search"] },
            "body": { "mode": "raw", "raw": "{\n  \"adults\": 2,\n  \"children\": 0,\n  \"currency\": \"EUR\"\n}" }
          }
        }
      ]
    },
    {
      "name": "İçerik / Referans",
      "item": [
        {
          "name": "GET /v1/destinations (q / countryCode / popüler)",
          "request": {
            "method": "GET",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" } ],
            "url": { "raw": "{{baseUrl}}/v1/destinations?q=Antalya&countryCode=TR&perPage=20", "host": ["{{baseUrl}}"], "path": ["v1","destinations"], "query": [ { "key": "q", "value": "Antalya" }, { "key": "countryCode", "value": "TR" }, { "key": "perPage", "value": "20" } ] }
          }
        },
        {
          "name": "GET /v1/hotels/{id} (otel içerik)",
          "request": {
            "method": "GET",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" } ],
            "url": { "raw": "{{baseUrl}}/v1/hotels/371", "host": ["{{baseUrl}}"], "path": ["v1","hotels","371"] }
          }
        }
      ]
    },
    {
      "name": "Booking",
      "description": "Booking sandbox/UAT: gerçek para alınmaz. Idempotency-Key ZORUNLU (aynı key → aynı yanıt, çift booking yok). AgencyId token'dan (sunucu-otoriter).",
      "item": [
        {
          "name": "POST /v1/bookings (otel — sale-uat)",
          "event": [
            { "listen": "test", "script": { "type": "text/javascript", "exec": [
              "var j = pm.response.json();",
              "if (j.bookingRef) { pm.collectionVariables.set('bookingRef', j.bookingRef); }"
            ] } }
          ],
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Idempotency-Key", "value": "{{idempotencyKey}}" } ],
            "url": { "raw": "{{baseUrl}}/v1/bookings", "host": ["{{baseUrl}}"], "path": ["v1","bookings"] },
            "body": { "mode": "raw", "raw": "{\n  \"type\": \"hotel\",\n  \"amount\": 100.00,\n  \"currency\": \"EUR\",\n  \"clientReference\": \"acente-001\",\n  \"data\": {\n    \"clientReference\": \"acente-001\",\n    \"rate\": { \"rateKey\": \"<arama sonucundaki rateKey>\" },\n    \"holder\": { \"name\": \"Ahmet\", \"surname\": \"Yilmaz\" }\n  }\n}" }
          }
        },
        {
          "name": "POST /v1/bookings (tur)",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Idempotency-Key", "value": "tour-001" } ],
            "url": { "raw": "{{baseUrl}}/v1/bookings", "host": ["{{baseUrl}}"], "path": ["v1","bookings"] },
            "body": { "mode": "raw", "raw": "{\n  \"type\": \"tour\",\n  \"amount\": 500.00,\n  \"currency\": \"EUR\",\n  \"data\": {\n    \"tourPackageId\": 1,\n    \"tourPeriodId\": 1,\n    \"passengers\": [ { \"firstName\": \"Ahmet\", \"lastName\": \"Yilmaz\", \"paxType\": 1 } ]\n  }\n}" }
          }
        },
        {
          "name": "POST /v1/bookings (cruise)",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Idempotency-Key", "value": "cruise-001" } ],
            "url": { "raw": "{{baseUrl}}/v1/bookings", "host": ["{{baseUrl}}"], "path": ["v1","bookings"] },
            "body": { "mode": "raw", "raw": "{\n  \"type\": \"cruise\",\n  \"data\": {\n    \"sailingId\": 1,\n    \"cabinId\": 1,\n    \"adults\": 2,\n    \"childAges\": [],\n    \"guestName\": \"Ahmet Yilmaz\",\n    \"email\": \"ahmet@example.com\",\n    \"phone\": \"+905551234567\"\n  }\n}" }
          }
        },
        {
          "name": "GET /v1/bookings/{reference} (durum)",
          "request": {
            "method": "GET",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" } ],
            "url": { "raw": "{{baseUrl}}/v1/bookings/{{bookingRef}}", "host": ["{{baseUrl}}"], "path": ["v1","bookings","{{bookingRef}}"] }
          }
        },
        {
          "name": "POST /v1/bookings/{reference}/cancel (iptal talebi)",
          "request": {
            "method": "POST",
            "header": [ { "key": "Authorization", "value": "Bearer {{token}}" }, { "key": "Content-Type", "value": "application/json" } ],
            "url": { "raw": "{{baseUrl}}/v1/bookings/{{bookingRef}}/cancel", "host": ["{{baseUrl}}"], "path": ["v1","bookings","{{bookingRef}}","cancel"] },
            "body": { "mode": "raw", "raw": "{\n  \"reason\": \"customer_request\",\n  \"description\": \"Müşteri talebi\"\n}" }
          }
        }
      ]
    }
  ]
}
