Skip to content

devrahuljourney/api-caller

Repository files navigation

TripJack hotel API test setup

This project now gives you two ways to test TripJack hotel APIs:

  • supabase/functions/tripjack-hotel-proxy/index.ts This is the Supabase Edge Function version.
  • supabase/functions/tripjack-playground/index.ts This serves a browser UI that calls the proxy edge function.
  • tripjack-local-proxy.mjs This is the Docker-free local proxy you can run directly with Node.

Run without Docker

  1. Create your env file:

    cp .env.example .env
  2. Put your TripJack API key in .env.

  3. Run the local proxy:

    npm run local
  4. Send requests to:

    http://127.0.0.1:8787/tripjack-hotel-proxy

Change the TripJack endpoint every time

Do not edit the server code. Just pass a different endpoint in the request body.

Default endpoint:

{
  "endpoint": "/hotel-searchquery-list"
}

Another example:

{
  "endpoint": "/hotel-details",
  "payload": {
    "id": "hsid9178304060-M184"
  }
}

You can also change the method if needed:

{
  "endpoint": "/some-endpoint",
  "method": "POST",
  "payload": {}
}

Test request

This example hits the default hotel search endpoint:

curl -i --request POST 'http://127.0.0.1:8787/tripjack-hotel-proxy' \
  --header 'Content-Type: application/json' \
  --data '{
    "endpoint": "/hotel-searchquery-list",
    "payload": {
      "searchQuery": {
        "checkinDate": "2025-05-10",
        "checkoutDate": "2025-05-12",
        "roomInfo": [
          {
            "numberOfAdults": 2,
            "numberOfChild": 0
          }
        ],
        "searchCriteria": {
          "city": "110203",
          "nationality": "106",
          "currency": "INR"
        }
      },
      "sync": false
    }
  }'

Supabase Edge Function version

If you want the full local Supabase stack with Studio and the Edge Function:

  1. Make sure Docker is running.

  2. Create the function env file:

    cp supabase/functions/.env.example supabase/functions/.env
  3. Put your real TripJack API key in supabase/functions/.env.

  4. Start everything:

    npm run supabase:local

That script runs:

  • supabase start
  • supabase functions serve --env-file supabase/functions/.env

Local URLs:

  • Supabase API: http://127.0.0.1:54321
  • Edge Function: http://127.0.0.1:54321/functions/v1/tripjack-hotel-proxy
  • Playground UI: http://127.0.0.1:54321/functions/v1/tripjack-playground
  • Studio UI: http://127.0.0.1:54323

Use the same request shape as the Node proxy:

{
  "endpoint": "/hotel-searchquery-list",
  "method": "POST",
  "payload": {}
}

Example:

curl --request POST 'http://127.0.0.1:54321/functions/v1/tripjack-hotel-proxy' \
  --header 'Content-Type: application/json' \
  --data '{
    "endpoint": "/hotel-details",
    "payload": {
      "id": "hsid9178304060-M184"
    }
}'

If you want a browser UI instead of curl, open:

http://127.0.0.1:54321/functions/v1/tripjack-playground

That page lets you:

  • change the TripJack endpoint every time
  • switch method
  • paste any JSON payload
  • send the request through the tripjack-hotel-proxy edge function
  • inspect the raw response

TRIPJACK_API_URL defaults to https://apitest.tripjack.com/hms/v1. If your TripJack hotel environment uses a different base URL, update .env or supabase/functions/.env.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors