Permission To Access Resource error in Kiwi Tequila API GET /search

605 views Asked by At

I am using tequila API to search for flights given a from and to date. My API Request is as follows:

const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api.tequila.kiwi.com/v2/search?fly_from=LHR&fly_to=MJI&dateFrom=25/05/2023&dateTo=13/06/2023',
  headers: { 
    'apikey': '-YDB6i895qUbvkh2NWKL4o62_Nn2JFnT'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

My response is:

{
    "error_code": 403,
    "message": "You don't have permission to access this resource"
}

I am using the following documentations:

When I use content-encoding gzip, it doesn't process my API and says:

"Error: Cloud agent is unreachable"

Also, in the first URL, it says:

Use a proper content type in the headers for all requests to Tequila API: Content-Type: application/json
Use your API key in the headers for all requests to Tequila API: apikey: yourapikeyvalue
The responses of our API are G-zipped and you need to unpack them by using the proper response header encoding: Content-Encoding: gzip
Please use the booking_token throughout the whole Booking API flow that you received in the /search response. The booking token cannot be older than 30 minutes.
The date and time in the Booking API are in the iso timestamp format

In my understanding, this means that the first API I should call is the /search API where I will get the booking token in the response.

My goal is to book/check flights and hence, develop a flight booking application for Libya.

0

There are 0 answers