Tripadvisor

FREEMIUM
By DataCrawler | Updated a day ago | Travel
Popularity

9.8 / 10

Latency

4,643ms

Service Level

100%

Health Check

100%

Back to All Discussions

No data in endpoint

Rapid account: Shubhnak
shubhnak
15 days ago

I tried to create an API endpoint using this API and the problem is that I get success : true and status code also 200 but data array is empty and I want the geoId of the place from this endpoint

Help me !

THIS IS THE ENDPOINT CREATED BY ME

router.get(’/first’, async (req, res) => {

const locationQuery = req.query;
const url = https://tripadvisor16.p.rapidapi.com/api/v1/hotels/searchLocation?query=${encodeURIComponent(locationQuery)};
const options = {
method: ‘GET’,
headers: {
‘X-RapidAPI-Key’: ‘API_KEY’,
‘X-RapidAPI-Host’: ‘tripadvisor16.p.rapidapi.com
}
};

(async () => {
try {
const response = await fetch(url, options);
const result = await response.json(); // Assuming the API returns JSON
console.log(‘Status:’, response.status);
console.log(‘Headers:’, response.headers.raw());
console.log(‘Full response:’, result);

  if (!result || result.length === 0) {
    console.log('No data returned. Check if the query parameter is correct and if there are any usage limits.');
  }
} catch (error) {
  console.error('Error:', error);
}

})();

});

AND THIS IS THE RESPONSE THAT I RECEIVE

Full response: {
status: true,
message: ‘Success’,
timestamp: 1716062397013,
data: []
}

Rapid account: Data Crawler
DataCrawler Commented 14 days ago

Hello,

While checking the logs, we found out that you are sending undefine as the query parameter. Take a look at the screenshot below.

Thanks.

Rapid account: Data Crawler
DataCrawler Commented 14 days ago

Hello,

Our tech is been looking into this. I’ll update you as soon as I get an update.

Thanks

Join in the discussion - add comment below:

Login / Signup to post new comments