{
  "info": {
    "_postman_id": "4aac230f-75cc-4915-a3ea-ccc3eae7f4b8",
    "name": "Guru_API",
    "description": "# 🚀 Get started here\n\nThis collection guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\n\n## 🔖 **How to use this collection**\n\n#### **Step 1: Send requests**\n\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\n\nThis collection contains each of these request types. Open each request and click \"Send\" to see what happens.\n\n#### **Step 2: View responses**\n\nObserve the response tab for status code (200 OK), response time, and size.\n\n#### **Step 3: Send new Body data**\n\nUpdate or add new data in \"Body\" in the POST request. Typically, Body data is also used in PUT and PATCH requests.\n\n```\n{\n    \"name\": \"Add your name in the body\"\n}\n\n```\n\n#### **Step 4: Update the variable**\n\nVariables enable you to store and reuse values in Postman. We have created a variable called `base_url` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\n\n#### **Step 5: Add tests in the \"Tests\" tab**\n\nTests help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \"Test Results\" tab.\n\n<img src=\"https://content.pstmn.io/b5f280a7-4b09-48ec-857f-0a7ed99d7ef8/U2NyZWVuc2hvdCAyMDIzLTAzLTI3IGF0IDkuNDcuMjggUE0ucG5n\">\n\n## 💪 Pro tips\n\n- Use folders to group related requests and organize the collection.\n- Add more scripts in \"Tests\" to verify if the API works as expected and execute flows.\n    \n\n## ℹ️ Resources\n\n[Building requests](https://learning.postman.com/docs/sending-requests/requests/)  \n[Authorizing requests](https://learning.postman.com/docs/sending-requests/authorization/)  \n[Using variables](https://learning.postman.com/docs/sending-requests/variables/)  \n[Managing environments](https://learning.postman.com/docs/sending-requests/managing-environments/)  \n[Writing scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/)",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "959327"
  },
  "item": [
    {
      "name": "Auth",
      "item": [
        {
          "name": "Auth - Access Token",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns access_token and refresh_token\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.access_token, \"access_token\").to.be.a(\"string\").and.not.empty;",
                  "    pm.expect(body.refresh_token, \"refresh_token\").to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"access_token\", body.access_token);",
                  "    pm.environment.set(\"refresh_token\", body.refresh_token);",
                  "});",
                  "",
                  "pm.test(\"response time < 5000ms\", () => pm.expect(pm.response.responseTime).to.be.below(5000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"username\": \"{{username}}\",\n    \"password\": \"{{password}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{url}}/oauth/token",
              "host": ["{{url}}"],
              "path": ["oauth", "token"]
            }
          },
          "response": []
        },
        {
          "name": "Auth - Refresh Token",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns new access_token and refresh_token\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.access_token, \"access_token\").to.be.a(\"string\").and.not.empty;",
                  "    pm.expect(body.refresh_token, \"refresh_token\").to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"access_token\", body.access_token);",
                  "    pm.environment.set(\"refresh_token\", body.refresh_token);",
                  "});",
                  "",
                  "pm.test(\"response time < 5000ms\", () => pm.expect(pm.response.responseTime).to.be.below(5000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"refresh_token\": \"{{refresh_token}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{url}}/oauth/refreshtoken",
              "host": ["{{url}}"],
              "path": ["oauth", "refreshtoken"]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Shopping",
      "item": [
        {
          "name": "Get Offers",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns non-empty offers array\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.offers, \"offers\").to.be.an(\"array\").and.not.empty;",
                  "});",
                  "",
                  "pm.test(\"each offer has journeys with slices and a token\", () => {",
                  "    const offers = pm.response.json().offers;",
                  "    offers.forEach((offer, i) => {",
                  "        pm.expect(offer.journeys, `offer[${i}].journeys`).to.be.an(\"array\").and.not.empty;",
                  "        offer.journeys.forEach((j, ji) => {",
                  "            pm.expect(j.slices, `offer[${i}].journeys[${ji}].slices`).to.be.an(\"array\").and.not.empty;",
                  "            j.slices.forEach((s, si) => {",
                  "                pm.expect(s.token, `offer[${i}].journeys[${ji}].slices[${si}].token`).to.be.a(\"string\").and.not.empty;",
                  "            });",
                  "        });",
                  "    });",
                  "});",
                  "",
                  "pm.test(\"saves first slice token for Price Offer\", () => {",
                  "    const body = pm.response.json();",
                  "    const token = body.offers[0].journeys[0].slices[0].token;",
                  "    pm.expect(token).to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"selected_tokens\", token);",
                  "});",
                  "",
                  "pm.test(\"response time < 10000ms\", () => pm.expect(pm.response.responseTime).to.be.below(10000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{url}}/offers?adts=1&chds=0&infs=0&provider_type=AZUL&route=SAO,REC,2026-03-20",
              "host": ["{{url}}"],
              "path": ["offers"],
              "query": [
                { "key": "adts", "value": "1" },
                { "key": "chds", "value": "0" },
                { "key": "infs", "value": "0" },
                { "key": "provider_type", "value": "AZUL" },
                { "key": "route", "value": "SAO,REC,2026-03-20" }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Price Offer",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns offer object\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.offer, \"offer\").to.be.an(\"object\");",
                  "    pm.expect(body.offer.journeys, \"offer.journeys\").to.be.an(\"array\").and.not.empty;",
                  "});",
                  "",
                  "pm.test(\"offer has price\", () => {",
                  "    const offer = pm.response.json().offer;",
                  "    pm.expect(offer.price, \"offer.price\").to.be.an(\"object\");",
                  "    pm.expect(offer.price.total, \"offer.price.total\").to.be.a(\"number\").and.above(0);",
                  "});",
                  "",
                  "pm.test(\"saves priced token for Create Booking\", () => {",
                  "    const body = pm.response.json();",
                  "    const token = body.offer.journeys[0].slices[0].token;",
                  "    pm.expect(token).to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"selected_tokens\", token);",
                  "});",
                  "",
                  "pm.test(\"response time < 10000ms\", () => pm.expect(pm.response.responseTime).to.be.below(10000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{url}}/offers/price?slice_tokens={{selected_tokens}}",
              "host": ["{{url}}"],
              "path": ["offers", "price"],
              "query": [
                { "key": "slice_tokens", "value": "{{selected_tokens}}" }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Booking",
      "item": [
        {
          "name": "Create Booking",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns booking object with id\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.booking, \"booking\").to.be.an(\"object\");",
                  "    pm.expect(body.booking.id, \"booking.id\").to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"booking_id\", body.booking.id);",
                  "});",
                  "",
                  "pm.test(\"booking has provider locator\", () => {",
                  "    const booking = pm.response.json().booking;",
                  "    pm.expect(booking.provider, \"booking.provider\").to.be.an(\"object\");",
                  "    pm.expect(booking.provider.locator, \"booking.provider.locator\").to.be.a(\"string\").and.not.empty;",
                  "    pm.environment.set(\"loc\", booking.provider.locator);",
                  "});",
                  "",
                  "pm.test(\"booking has passengers\", () => {",
                  "    const booking = pm.response.json().booking;",
                  "    pm.expect(booking.passengers, \"booking.passengers\").to.be.an(\"array\").and.not.empty;",
                  "});",
                  "",
                  "pm.test(\"response time < 15000ms\", () => pm.expect(pm.response.responseTime).to.be.below(15000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"selected_tokens\": [\n    \"{{selected_tokens}}\"\n  ],\n  \"passengers\": [\n    {\n      \"pax_type\": \"ADT\",\n      \"first_name\": \"John\",\n      \"last_name\": \"Doe\",\n      \"gender_type\": \"MALE\",\n      \"birth_date\": \"2000-08-24\",\n      \"phone_number\": \"55 11 999559999\",\n      \"email\": \"john@mymail.com\",\n      \"frequent_flyers\": [\n        {\n          \"airline\": \"G3\",\n          \"code\": \"116444\"\n        }\n      ],\n      \"nationality\": \"BR\",\n      \"documents\": [\n        {\n          \"unique_identifier\": \"7515199\",\n          \"type\": \"PASSPORT\",\n          \"issuing_country_code\": \"BR\",\n          \"created_at\": \"2019-08-24\",\n          \"expires_at\": \"2033-08-24\"\n        }\n      ]\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{url}}/bookings",
              "host": ["{{url}}"],
              "path": ["bookings"]
            }
          },
          "response": []
        },
        {
          "name": "Get Booking",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "",
                  "pm.test(\"returns booking object with matching id\", () => {",
                  "    const body = pm.response.json();",
                  "    pm.expect(body.booking, \"booking\").to.be.an(\"object\");",
                  "    pm.expect(body.booking.id, \"booking.id\").to.equal(pm.environment.get(\"booking_id\"));",
                  "});",
                  "",
                  "pm.test(\"booking has slices\", () => {",
                  "    const booking = pm.response.json().booking;",
                  "    pm.expect(booking.slices, \"booking.slices\").to.be.an(\"array\").and.not.empty;",
                  "});",
                  "",
                  "pm.test(\"response time < 10000ms\", () => pm.expect(pm.response.responseTime).to.be.below(10000));"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{url}}/bookings/{{booking_id}}",
              "host": ["{{url}}"],
              "path": ["bookings", "{{booking_id}}"]
            }
          },
          "response": []
        }
      ]
    }
  ],
  "auth": {
    "type": "bearer"
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [""]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [""]
      }
    }
  ],
  "variable": [
    {
      "key": "id",
      "value": "1",
      "disabled": true
    },
    {
      "key": "base_url",
      "value": "https://postman-rest-api-learner.glitch.me/",
      "disabled": true
    },
    {
      "key": "number",
      "value": "5774995096800"
    }
  ]
}
